Skip to content

Commit 14681e0

Browse files
authored
Proposed fix for #1730 (#1705)
1 parent c341a18 commit 14681e0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

osxphotos/exif_datetime_updater.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def update_photos_from_exif(
183183
)
184184
return None
185185

186-
if dtinfo.offset_seconds:
186+
if dtinfo.offset_seconds is not None:
187187
# update timezone then update date/time
188188
timezone = Timezone(dtinfo.offset_seconds)
189189
tzupdater = PhotoTimeZoneUpdater(

osxphotos/exifutils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def get_exif_date_time_offset(
100100

101101
# try to get offset from EXIF:OffsetTimeOriginal
102102
offset = exif.get("EXIF:OffsetTimeOriginal") or exif.get("OffsetTimeOriginal")
103-
if dt and not offset:
103+
if dt and offset is None:
104104
# see if offset set in the dt string
105105
for pattern in (
106106
r"\d{4}:\d{2}:\d{2}\s\d{2}:\d{2}:\d{2}([+-]\d{2}:\d{2})",
@@ -130,7 +130,7 @@ def get_exif_date_time_offset(
130130
offset_seconds = exif_offset_to_seconds(offset) if offset else None
131131

132132
if dt:
133-
if offset:
133+
if offset is not None:
134134
# drop offset from dt string and add it back on in datetime %z format
135135
dt = re.sub(r"[+-]\d{2}:\d{2}$", "", dt)
136136
dt = re.sub(r"\.\d+$", "", dt)

0 commit comments

Comments
 (0)