Skip to content

fix: preserve EXIF timezone offset in JPEG export#1246

Open
marceldenzer wants to merge 1 commit into
CyberTimon:mainfrom
marceldenzer:main
Open

fix: preserve EXIF timezone offset in JPEG export#1246
marceldenzer wants to merge 1 commit into
CyberTimon:mainfrom
marceldenzer:main

Conversation

@marceldenzer
Copy link
Copy Markdown

Summary

  • Bug 1 fixed: DateTimeOriginal was written without inline timezone offset (e.g. 2026-06-05 11:33:26 instead of 2026:06:05 11:33:26+02:00), causing Apple Photos and other viewers to misinterpret the time as UTC
  • Bug 2 fixed: Exported JPEG file modification time was +2h — get_creation_date_from_path treated local camera time as UTC before calling set_file_times
  • OffsetTime tags added: All three write branches now write OffsetTime, OffsetTimeOriginal, and OffsetTimeDigitized tags for maximum compatibility

Changes in src-tauri/src/exif_processing.rs

  • combine_datetime_with_offset: new helper that normalises the date separator (dashes → colons) and appends the timezone offset inline per EXIF 2.31 spec
  • parse_offset_secs: new helper that converts +HH:MM / -HH:MM strings to seconds east of UTC; strips surrounding quotes from kamadak-exif display_value() output to prevent silent parse failures
  • get_creation_date_from_path (sidecar branch): reads OffsetTimeOriginal/OffsetTime from the sidecar map and subtracts the offset before constructing DateTime<Utc>; falls back to reading the offset directly from the RAW file via rawler when the sidecar predates OffsetTime support
  • get_creation_date_from_path (rawler branch): same UTC conversion applied
  • write_image_with_metadata (all three branches — sidecar map, kamadak-exif, rawler): DateTimeOriginal and CreateDate now include the inline offset; all three OffsetTime* tags are written

Test plan

  • Export a JPEG from an ARW/RAW source with a known timezone offset
  • Verify DateTimeOriginal in exported JPEG contains inline offset (e.g. 2026:06:05 11:33:26+02:00)
  • Verify OffsetTimeOriginal / OffsetTime / OffsetTimeDigitized tags are present
  • Verify file modification date/time matches capture time (not offset by the UTC difference)
  • Import exported JPEG into Apple Photos and confirm displayed time is correct
  • Test with a sidecar created before this fix (no OffsetTime key) to confirm rawler fallback works

🤖 Generated with Claude Code

- combine_datetime_with_offset: write offset inline into DateTimeOriginal
  and CreateDate (e.g. 2026:06:05 11:33:26+02:00) per EXIF 2.31 spec
- parse_offset_secs: strip surrounding quotes from offset string returned
  by kamadak-exif to prevent format errors
- get_creation_date_from_path: correctly convert local datetime to UTC
  before setting file mtime, fixing +2h offset on exported JPEGs
- Rawler fallback: read offset directly from RAW file when sidecar
  does not contain OffsetTime (backwards compatibility for old sidecars)

Fixes: File Modification Date/Time showing +2h on export
Fixes: DateTimeOriginal written without inline timezone offset

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant