From 8dcc7810f07e2ce76ebee50c70a5c16f1bc9edec Mon Sep 17 00:00:00 2001 From: Richard Eames Date: Thu, 12 Jun 2014 10:58:50 -0600 Subject: [1.7.x] Fixed #22814 -- Allowed ISO-8601 [+-]hh timezone format in parse_datetime Backport of 7beaeeed from master. --- django/utils/dateparse.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'django/utils/dateparse.py') diff --git a/django/utils/dateparse.py b/django/utils/dateparse.py index f2c079023f..cb45a2760b 100644 --- a/django/utils/dateparse.py +++ b/django/utils/dateparse.py @@ -24,7 +24,7 @@ datetime_re = re.compile( r'(?P\d{4})-(?P\d{1,2})-(?P\d{1,2})' r'[T ](?P\d{1,2}):(?P\d{1,2})' r'(?::(?P\d{1,2})(?:\.(?P\d{1,6})\d{0,6})?)?' - r'(?PZ|[+-]\d{2}:?\d{2})?$' + r'(?PZ|[+-]\d{2}(?::?\d{2})?)?$' ) @@ -76,7 +76,8 @@ def parse_datetime(value): if tzinfo == 'Z': tzinfo = utc elif tzinfo is not None: - offset = 60 * int(tzinfo[1:3]) + int(tzinfo[-2:]) + offset_mins = int(tzinfo[-2:]) if len(tzinfo) > 3 else 0 + offset = 60 * int(tzinfo[1:3]) + offset_mins if tzinfo[0] == '-': offset = -offset tzinfo = get_fixed_timezone(offset) -- cgit v1.3