##// END OF EJS Templates
tweak regexp handling of tzinfo...
MinRK -
Show More
@@ -33,7 +33,7 b" next_attr_name = '__next__' if py3compat.PY3 else 'next'"
33 33
34 34 # timestamp formats
35 35 ISO8601="%Y-%m-%dT%H:%M:%S.%f"
36 ISO8601_PAT=re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z?([\+\-]\d{2}:?\d{2})?$")
36 ISO8601_PAT=re.compile(r"^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+)Z?([\+\-]\d{2}:?\d{2})?$")
37 37
38 38 #-----------------------------------------------------------------------------
39 39 # Classes and functions
@@ -71,9 +71,11 b' def extract_dates(obj):'
71 71 elif isinstance(obj, (list, tuple)):
72 72 obj = [ extract_dates(o) for o in obj ]
73 73 elif isinstance(obj, basestring):
74 if ISO8601_PAT.match(obj):
74 m = ISO8601_PAT.match(obj)
75 if m:
75 76 # FIXME: add actual timezone support
76 notz = obj.split('Z',1)[0]
77 # this just drops the timezone info
78 notz = m.groups()[0]
77 79 obj = datetime.strptime(notz, ISO8601)
78 80 return obj
79 81
General Comments 0
You need to be logged in to leave comments. Login now