Skip to content

Commit

Permalink
Fix 'ValueError: year is out of range' when year is set to 0000. Just…
Browse files Browse the repository at this point in the history
… set the time to the earliest valid time (in 1970)
  • Loading branch information
ndbroadbent committed Jul 21, 2018
1 parent 3899363 commit fa64441
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pyicloud/services/photos.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,12 @@ def created(self):

@property
def asset_date(self):
dt = datetime.fromtimestamp(
self._asset_record['fields']['assetDate']['value'] / 1000.0,
tz=pytz.utc)
try:
dt = datetime.fromtimestamp(
self._asset_record['fields']['assetDate']['value'] / 1000.0,
tz=pytz.utc)
except:
dt = datetime.fromtimestamp(0)
return dt

@property
Expand Down

0 comments on commit fa64441

Please sign in to comment.