fix for date parsing

This commit is contained in:
ziirish 2021-09-17 12:50:52 +02:00
parent b151109756
commit 2e77865bd9
No known key found for this signature in database
GPG key ID: 72DB229A64B54E46

View file

@ -33,8 +33,11 @@ class DateTime(fields.DateTime):
a = arrow.get(datetime.datetime.utcfromtimestamp(value))
a = a.replace(tzinfo=TZ)
except (ValueError, TypeError):
a = arrow.get(value)
a = a.to(TZ)
try:
a = arrow.get(value)
a = a.to(TZ)
except arrow.parser.ParserError:
return value
return fields.DateTime.parse(self, a.datetime)
def format(self, value):