-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 03/13/2010 07:25 AM, Cullen Jennings wrote: > > Wow - I never imagined such a rapid response to this question. Thanks. > > I've replied with roughly "Yep, they might be a bit confusing but everything else is worse so that's what we use". Another solution is to let the user choose the representation. Attached is a patch to add an option in the trac preference panel for the presentation format. The second attachment is a macro that can be used in the wiki to annotate the dates, something like this: [[Date(2010-01-02)]] For example with a format of "%a, %d %b %Y", the wiki will display this: Fri, 01 Jan 2010 - -- Marc Petit-Huguenin Personal email: marc@xxxxxxxxxxxxxxxxxx Professional email: petithug@xxxxxxx Blog: http://blog.marc.petit-huguenin.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAkub2GIACgkQ9RoMZyVa61caQACdHMgMaGnmn2PdhSArddvUZ9l5 TFkAoI4B+dJW3mEhCTsFCwdazBMXh/fQ =b0km -----END PGP SIGNATURE-----
--- /usr/share/pyshared/trac/prefs/web_ui.py 2010-03-09 14:49:38.000000000 -0800 +++ /usr/share/pyshared/trac/prefs/web_ui.py.new 2010-03-13 10:11:54.000000000 -0800 @@ -36,7 +36,7 @@ implements(INavigationContributor, IPreferencePanelProvider, IRequestHandler, ITemplateProvider) - _form_fields = ['newsid', 'name', 'email', 'tz', 'accesskeys'] + _form_fields = ['newsid', 'name', 'email', 'tz', 'format', 'accesskeys'] # INavigationContributor methods --- /usr/share/pyshared/trac/prefs/templates/prefs_datetime.html 2010-03-09 14:49:38.000000000 -0800 +++ /usr/share/pyshared/trac/prefs/templates/prefs_datetime.html.new 2010-03-13 10:11:38.000000000 -0800 @@ -39,5 +39,13 @@ </div> + <div class="field"> + <label>Format: + <input type="text" id="format" name="format" size="30" value="${settings.session.get('format')}" /> + </label> + <p class="hint"> + ISO8601 or a strftime format string + </p> + </div> </body> </html>
from datetime import datetime from trac.util.datefmt import format_date, parse_date, timezone from trac.wiki.macros import WikiMacroBase from trac.web.api import Request from trac.util.text import to_unicode class DateMacro(WikiMacroBase): """Displays the date/time in the format selected by the user The date or date/time must be in ISO8601 format """ revision = "$Rev$" url = "$URL$" def expand_macro(self, formatter, name, args): t = parse_date(args) fmt = formatter.req.session.get('format') or 'iso8601' fmt = to_unicode(fmt).encode('ascii', 'replace') tz = timezone(formatter.req.session['tz']) return format_date(t, fmt, tz)
_______________________________________________ Ietf mailing list Ietf@xxxxxxxx https://www.ietf.org/mailman/listinfo/ietf