Edgewall Software

Ticket #2182: trac_iso8601.patch.txt

File trac_iso8601.patch.txt, 1.3 KB (added by follower, 14 years ago)

Hacky patch to force dates & times to be formatted as ISO8601 YYYY-MM-DD etc

Line 
1--- lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/util/datefmt.py~ Sun Feb 21 22:09:38 2010
2+++ lib/python2.5/site-packages/Trac-0.11.6-py2.5.egg/trac/util/datefmt.py Tue Feb 23 04:32:59 2010
3@@ -93,7 +93,7 @@
4 return '%d %s' % (r, r == 1 and unit or unit_plural)
5 return ''
6
7-def format_datetime(t=None, format='%x %X', tzinfo=None):
8+def format_datetime(t=None, format='iso8601', tzinfo=None):
9 """Format the `datetime` object `t` into an `unicode` string
10
11 If `t` is None, the current time will be used.
12@@ -131,7 +131,7 @@
13 # Python 2.3 on windows doesn't know about 'XYZ' alias for 'cpXYZ'
14 return unicode(text, encoding, 'replace')
15
16-def format_date(t=None, format='%x', tzinfo=None):
17+def format_date(t=None, format='iso8601', tzinfo=None):
18 """Convenience method for formatting the date part of a `datetime` object.
19 See `format_datetime` for more details.
20 """
21@@ -139,7 +139,7 @@
22 format = 'iso8601date'
23 return format_datetime(t, format, tzinfo=tzinfo)
24
25-def format_time(t=None, format='%X', tzinfo=None):
26+def format_time(t=None, format='iso8601', tzinfo=None):
27 """Convenience method for formatting the time part of a `datetime` object.
28 See `format_datetime` for more details.
29 """