Ticket #1690: trac-0.9.5-ISO8601.patch
| File trac-0.9.5-ISO8601.patch, 2.0 KB (added by mark@…, 3 years ago) |
|---|
-
trac/scripts/admin.py
284 284 seconds = int(time.time()) 285 285 else: 286 286 for format in [self._date_format, '%x %X', '%x, %X', '%X %x', '%X, %x', '%x', '%c', 287 '%b %d, %Y' ]:287 '%b %d, %Y', '%Y-%m-%d %X']: 288 288 try: 289 289 pt = time.strptime(t, format) 290 290 seconds = int(time.mktime(pt)) -
trac/Timeline.py
96 96 t = time.localtime() 97 97 if req.args.has_key('from'): 98 98 try: 99 t = time.strptime(req.args.get('from'), '% x')99 t = time.strptime(req.args.get('from'), '%Y-%m-%d') 100 100 except: 101 101 pass 102 102 -
trac/util.py
396 396 397 397 # Date/time utilities 398 398 399 def format_datetime(t=None, format='% x%X', gmt=False):399 def format_datetime(t=None, format='%Y-%m-%d %X', gmt=False): 400 400 if t is None: 401 401 t = time.time() 402 402 if not isinstance(t, (list, tuple, time.struct_time)): … … 408 408 text = time.strftime(format, t) 409 409 return to_utf8(text) 410 410 411 def format_date(t=None, format='% x', gmt=False):411 def format_date(t=None, format='%Y-%m-%d', gmt=False): 412 412 return format_datetime(t, format, gmt) 413 413 414 414 def format_time(t=None, format='%X', gmt=False): … … 447 447 seconds = None 448 448 text = text.strip() 449 449 for format in ['%x %X', '%x, %X', '%X %x', '%X, %x', '%x', '%c', 450 '%b %d, %Y' ]:450 '%b %d, %Y', '%Y-%m-%d %X']: 451 451 try: 452 452 date = time.strptime(text, format) 453 453 seconds = time.mktime(date)
