Edgewall Software

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)

version 0.10.4

  • trac/util/datefmt.py

    old new  
    4848            return '%d %s' % (r, r == 1 and unit or unit_plural) 
    4949    return '' 
    5050 
    51 def format_datetime(t=None, format='%Y-%m-%d %X', gmt=False): 
     51def format_datetime(t=None, format='%x %X', gmt=False): 
    5252    if t is None: 
    5353        t = time.time() 
    5454    if not isinstance(t, (list, tuple, time.struct_time)): 
     
    6464        # the above is broken on win32, e.g. we'd get '437' instead of 'cp437' 
    6565    return unicode(text, encoding, 'replace') 
    6666 
    67 def format_date(t=None, format='%Y-%m-%d', gmt=False): 
     67def format_date(t=None, format='%x', gmt=False): 
    6868    return format_datetime(t, format, gmt) 
    6969 
    7070def format_time(t=None, format='%X', gmt=False): 
     
    103103    seconds = None 
    104104    text = text.strip() 
    105105    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']: 
    107107        try: 
    108108            date = time.strptime(text, format) 
    109109            seconds = time.mktime(date)