Ticket #1690: trac-0.10.4-ISO8601.2.patch
| File trac-0.10.4-ISO8601.2.patch, 1.1 KB (added by salrae@…, 19 months ago) |
|---|
-
trac/util/datefmt.py
old new 48 48 return '%d %s' % (r, r == 1 and unit or unit_plural) 49 49 return '' 50 50 51 def format_datetime(t=None, format='% Y-%m-%d%X', gmt=False):51 def format_datetime(t=None, format='%x %X', gmt=False): 52 52 if t is None: 53 53 t = time.time() 54 54 if not isinstance(t, (list, tuple, time.struct_time)): … … 64 64 # the above is broken on win32, e.g. we'd get '437' instead of 'cp437' 65 65 return unicode(text, encoding, 'replace') 66 66 67 def format_date(t=None, format='% Y-%m-%d', gmt=False):67 def format_date(t=None, format='%x', gmt=False): 68 68 return format_datetime(t, format, gmt) 69 69 70 70 def format_time(t=None, format='%X', gmt=False): … … 103 103 seconds = None 104 104 text = text.strip() 105 105 for format in ['%x %X', '%x, %X', '%X %x', '%X, %x', '%x', '%c', 106 '%b %d, %Y' , '%Y-%m-%d %X', '%Y-%m-%d']:106 '%b %d, %Y']: 107 107 try: 108 108 date = time.strptime(text, format) 109 109 seconds = time.mktime(date)
