Update utils.py

add a proper fix for the issue, TODO make it more fault tolerant
This commit is contained in:
Hellowlol 2019-01-21 22:14:53 +01:00 committed by GitHub
parent 99a8037959
commit d227437054
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -180,7 +180,10 @@ def toDatetime(value, format=None):
else:
# https://bugs.python.org/issue30684
# And platform support for before epoch seems to be flaky.
value = datetime(1970, 1, 1) + timedelta(milliseconds=int(value))
# TODO check for others errors too.
if int(value) == 0:
value = 86400
value = datetime.fromtimestamp(int(value))
return value