Fixed bug in date() if imageTimeZoneOffsetSeconds was None

This commit is contained in:
Rhet Turnbull
2019-11-24 21:12:26 -08:00
parent 5af2b3e039
commit d4353d48bd

View File

@@ -980,7 +980,8 @@ class PhotoInfo:
def date(self):
""" image creation date as timezone aware datetime object """
imagedate = self.__info["imageDate"]
delta = timedelta(seconds=self.__info["imageTimeZoneOffsetSeconds"])
seconds = self.__info["imageTimeZoneOffsetSeconds"] or 0
delta = timedelta(seconds=seconds)
tz = timezone(delta)
imagedate_utc = imagedate.astimezone(tz=tz)
return imagedate_utc