Skip to content

Commit

Permalink
Proposed fix for #1730 (#1705)
Browse files Browse the repository at this point in the history
  • Loading branch information
oPromessa authored Nov 5, 2024
1 parent c341a18 commit 14681e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion osxphotos/exif_datetime_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def update_photos_from_exif(
)
return None

if dtinfo.offset_seconds:
if dtinfo.offset_seconds is not None:
# update timezone then update date/time
timezone = Timezone(dtinfo.offset_seconds)
tzupdater = PhotoTimeZoneUpdater(
Expand Down
4 changes: 2 additions & 2 deletions osxphotos/exifutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def get_exif_date_time_offset(

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

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

0 comments on commit 14681e0

Please sign in to comment.