[PR #21735] Fix timezone extraction prioritization to prevent mixing EXIF dates with XMP offset #21654 #16944

Open
opened 2026-02-05 16:13:22 +03:00 by OVERLORD · 0 comments
Owner

Original Pull Request: https://github.com/immich-app/immich/pull/21735

State: open
Merged: No


Description

This change implements proper timezone extraction prioritization to fix the issue where Immich was combining Date from Exif:DateTimeOriginal with Offset from XMP:CreateDate. The problem
occurred when different EXIF tags contained timezone information for different dates, leading to incorrect timezone associations.

The fix introduces a new extractTimezone() function that prioritizes timezone information in the correct order:

  1. OffsetTimeOriginal (original capture time timezone)
  2. OffsetTimeDigitized (digitization time timezone)
  3. OffsetTime (modification time timezone)
  4. exiftool-vendored's extracted timezone (fallback)

This ensures that timezone information is properly associated with the corresponding date/time data and prevents mixing timezones from different EXIF tags.

Fixes #21654

How Has This Been Tested?

  • Test A
  • Test B

Screenshots (if appropriate)

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if applicable
  • I have no unrelated changes in the PR.
  • I have confirmed that any new dependencies are strictly necessary.
  • I have written tests for new code (if applicable)
  • I have followed naming conventions/patterns in the surrounding code
  • All code in src/services/ uses repositories implementations for database calls, filesystem operations, etc.
  • All code in src/repositories/ is pretty basic/simple and does not have any immich specific logic (that belongs in src/services/)

Please describe to which degree, if any, an LLM was used in creating this pull request.

An LLM was used to help analyze the existing codebase, understand the issue, and verify that the implementation correctly addresses the problem. The actual code changes were made manually
and follow the existing patterns in the codebase. The LLM also helped identify potential edge cases and ensure comprehensive test coverage.
...

**Original Pull Request:** https://github.com/immich-app/immich/pull/21735 **State:** open **Merged:** No --- ## Description <!--- Describe your changes in detail --> <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here. --> This change implements proper timezone extraction prioritization to fix the issue where Immich was combining Date from Exif:DateTimeOriginal with Offset from XMP:CreateDate. The problem occurred when different EXIF tags contained timezone information for different dates, leading to incorrect timezone associations. The fix introduces a new extractTimezone() function that prioritizes timezone information in the correct order: 1. OffsetTimeOriginal (original capture time timezone) 2. OffsetTimeDigitized (digitization time timezone) 3. OffsetTime (modification time timezone) 4. exiftool-vendored's extracted timezone (fallback) This ensures that timezone information is properly associated with the corresponding date/time data and prevents mixing timezones from different EXIF tags. Fixes #21654 ## How Has This Been Tested? <!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration --> - [ ] Test A - [ ] Test B <details><summary><h2>Screenshots (if appropriate)</h2></summary> <!-- Images go below this line. --> </details> <!-- API endpoint changes (if relevant) ## API Changes The `/api/something` endpoint is now `/api/something-else` --> ## Checklist: - [x] I have performed a self-review of my own code - [x] I have made corresponding changes to the documentation if applicable - [x] I have no unrelated changes in the PR. - [x] I have confirmed that any new dependencies are strictly necessary. - [x] I have written tests for new code (if applicable) - [x] I have followed naming conventions/patterns in the surrounding code - [x] All code in `src/services/` uses repositories implementations for database calls, filesystem operations, etc. - [x] All code in `src/repositories/` is pretty basic/simple and does not have any immich specific logic (that belongs in `src/services/`) ## Please describe to which degree, if any, an LLM was used in creating this pull request. An LLM was used to help analyze the existing codebase, understand the issue, and verify that the implementation correctly addresses the problem. The actual code changes were made manually and follow the existing patterns in the codebase. The LLM also helped identify potential edge cases and ensure comprehensive test coverage. ...
OVERLORD added the pull-request label 2026-02-05 16:13:22 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#16944