Merge pull request #363 from apkallum/apkallum-django

fix: timestamp comparison in from_json function
This commit is contained in:
Nick Sweeting 2020-07-14 12:12:49 -04:00 committed by GitHub
commit 15c1cb39e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -190,7 +190,10 @@ class Link:
for key, val in json_info.items()
if key in cls.field_names()
}
info['updated'] = parse_date(info.get('updated'))
try:
info['updated'] = int(parse_date(info.get('updated'))) # Cast to int which comes with rounding down
except (ValueError, TypeError):
info['updated'] = None
info['sources'] = info.get('sources') or []
json_history = info.get('history') or {}