Fix 'ValueError: year is out of range' when year is set to 0000. Just set the time to the earliest valid time (in 1970)

This commit is contained in:
Nathan Broadbent 2018-07-22 03:32:52 +07:00
parent 3899363167
commit fa644415a4

View file

@ -452,9 +452,12 @@ class PhotoAsset(object):
@property
def asset_date(self):
try:
dt = datetime.fromtimestamp(
self._asset_record['fields']['assetDate']['value'] / 1000.0,
tz=pytz.utc)
except:
dt = datetime.fromtimestamp(0)
return dt
@property