More robust ISO date to timestamp conversion
This commit is contained in:
parent
bbb52ba191
commit
42eabcf661
1 changed files with 4 additions and 1 deletions
|
@ -35,6 +35,9 @@ class TravisciBackend(Backend):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _convert_iso_date(d):
|
def _convert_iso_date(d):
|
||||||
|
if not d:
|
||||||
|
return
|
||||||
|
|
||||||
if isinstance(d, int) or isinstance(d, float):
|
if isinstance(d, int) or isinstance(d, float):
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
@ -43,7 +46,7 @@ class TravisciBackend(Backend):
|
||||||
d = d[:-1] + '+00:00'
|
d = d[:-1] + '+00:00'
|
||||||
d = datetime.datetime.fromisoformat(d)
|
d = datetime.datetime.fromisoformat(d)
|
||||||
|
|
||||||
assert isinstance(d, datetime.datetime)
|
assert isinstance(d, datetime.datetime), 'Unexpected datetime type: ' + type(d)
|
||||||
return d.timestamp()
|
return d.timestamp()
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
|
Loading…
Reference in a new issue