Show More
@@ -33,7 +33,7 b" next_attr_name = '__next__' if py3compat.PY3 else 'next'" | |||||
33 |
|
33 | |||
34 | # timestamp formats |
|
34 | # timestamp formats | |
35 | ISO8601="%Y-%m-%dT%H:%M:%S.%f" |
|
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 | # Classes and functions |
|
39 | # Classes and functions | |
@@ -71,9 +71,11 b' def extract_dates(obj):' | |||||
71 | elif isinstance(obj, (list, tuple)): |
|
71 | elif isinstance(obj, (list, tuple)): | |
72 | obj = [ extract_dates(o) for o in obj ] |
|
72 | obj = [ extract_dates(o) for o in obj ] | |
73 | elif isinstance(obj, basestring): |
|
73 | elif isinstance(obj, basestring): | |
74 |
|
|
74 | m = ISO8601_PAT.match(obj) | |
|
75 | if m: | |||
75 | # FIXME: add actual timezone support |
|
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 | obj = datetime.strptime(notz, ISO8601) |
|
79 | obj = datetime.strptime(notz, ISO8601) | |
78 | return obj |
|
80 | return obj | |
79 |
|
81 |
General Comments 0
You need to be logged in to leave comments.
Login now