From fa644415a4f8ad21703810672da8c816f40d347f Mon Sep 17 00:00:00 2001 From: Nathan Broadbent Date: Sun, 22 Jul 2018 03:32:52 +0700 Subject: [PATCH] Fix 'ValueError: year is out of range' when year is set to 0000. Just set the time to the earliest valid time (in 1970) --- pyicloud/services/photos.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pyicloud/services/photos.py b/pyicloud/services/photos.py index 2b83071..47d2e37 100644 --- a/pyicloud/services/photos.py +++ b/pyicloud/services/photos.py @@ -452,9 +452,12 @@ class PhotoAsset(object): @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