Ticket #18728: django-dateparse.patch

File django-dateparse.patch, 916 bytes (added by jason@…, 12 years ago)

patch file for this issue, also found at github thaxter/django

  • django/utils/dateparse.py

    diff --git a/django/utils/dateparse.py b/django/utils/dateparse.py
    index 032eb49..3e28eb3 100644
    a b datetime_re = re.compile(  
    1919    r'(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})'
    2020    r'[T ](?P<hour>\d{1,2}):(?P<minute>\d{1,2})'
    2121    r'(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?'
    22     r'(?P<tzinfo>Z|[+-]\d{1,2}:\d{1,2})?$'
     22    r'(?P<tzinfo>Z|[+-]\d{1,2}:?\d{1,2})?$'
    2323)
    2424
    2525time_re = re.compile(
    def parse_datetime(value):  
    7777        if tzinfo == 'Z':
    7878            tzinfo = utc
    7979        elif tzinfo is not None:
    80             offset = 60 * int(tzinfo[1:3]) + int(tzinfo[4:6])
     80            tzinfo = re.sub(':','',tzinfo)
     81            offset = 60 * int(tzinfo[1:3]) + int(tzinfo[3:5])
    8182            if tzinfo[0] == '-':
    8283                offset = -offset
    8384            tzinfo = FixedOffset(offset)
Back to Top