File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3333
3434# timestamp formats
3535ISO8601 = "%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})?$" )
3737
3838#-----------------------------------------------------------------------------
3939# Classes and functions
@@ -71,9 +71,11 @@ def extract_dates(obj):
7171 elif isinstance (obj , (list , tuple )):
7272 obj = [ extract_dates (o ) for o in obj ]
7373 elif isinstance (obj , basestring ):
74- if ISO8601_PAT .match (obj ):
74+ m = ISO8601_PAT .match (obj )
75+ if m :
7576 # FIXME: add actual timezone support
76- notz = obj .split ('Z' ,1 )[0 ]
77+ # this just drops the timezone info
78+ notz = m .groups ()[0 ]
7779 obj = datetime .strptime (notz , ISO8601 )
7880 return obj
7981
You can’t perform that action at this time.
0 commit comments