Skip to content

Commit

Permalink
Proposed fix for RhetTbull#1730
Browse files Browse the repository at this point in the history
  • Loading branch information
oPromessa committed Oct 7, 2024
1 parent 808095c commit f285678
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 @@ -178,7 +178,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 @@ -97,7 +97,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 All @@ -122,7 +122,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 f285678

Please sign in to comment.