[PR #24310] [MERGED] fix(mobile): use correct timezone displayed in the info sheet #17812

Closed
opened 2026-02-05 16:27:55 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/24310
Author: @kao-byte
Created: 12/1/2025
Status: Merged
Merged: 12/2/2025
Merged by: @alextran1502

Base: mainHead: optimisation


📝 Commits (5)

  • c56b7ca fixed the timezone issue in the Immich mobile app's metadata sheet to match the web app's behavior
  • f1311c8 format dart
  • 697a6fb now uses the shared applyTimezoneOffset() utility function from mobile/lib/utils/timezone.dart
  • 7af2049 Merge branch 'main' of github.com:immich-app/immich into optimisation
  • 70bd804 add tests

📊 Changes

5 files changed (+345 additions, -26 deletions)

View changed files

📝 mobile/lib/extensions/asset_extensions.dart (+4 -17)
📝 mobile/lib/presentation/widgets/asset_viewer/bottom_sheet.widget.dart (+16 -6)
📝 mobile/lib/services/action.service.dart (+12 -3)
mobile/lib/utils/timezone.dart (+35 -0)
mobile/test/utils/timezone_test.dart (+278 -0)

📄 Description

Description

Fixes
#12650

This fix does not change any behaviour regarding the handling of date & time at the server side.

With this fix, both the metadata display and edit dialog show dates in the actual timezone where photos were taken, matching the web app's behavior exactly, regardless of the mobile devices' current timezone setting.

1. mobile/lib/presentation/widgets/asset_viewer/bottom_sheet.widget.dart

Why: The metadata sheet was displaying dates in the device's system timezone instead of the timezone where the photo was actually taken.

What changed:

  • Added imports for timezone package and duration_extensions
  • Rewrote the _getDateTime() method to use EXIF timezone information (dateTimeOriginal and timeZone fields)
  • Implemented the same timezone conversion logic as the web app, handling both named timezones (e.g., "Asia/Hong_Kong") and UTC offset formats (e.g., "UTC+08:00")
  • Updated the method signature to accept ExifInfo parameter
  • Changed timezone display format from manual string formatting to use formatAsOffset() extension with "GMT" prefix (same as the web app)

2. mobile/lib/services/action.service.dart
Why: The edit date/time dialog was also using the device's timezone when pre-filling the initial date, causing inconsistency between the displayed date and the editable date.

What changed:

  • Added import for timezone package
  • Rewrote the editDateTime() method to apply EXIF timezone conversion before showing the date picker
  • Used a local non-nullable DateTime variable to handle transformations safely
  • Applied the same EXIF timezone logic as the display method to ensure consistency
  • Properly set both timeZone and offset parameters for the date picker

How Has This Been Tested?

  • Tested on real iOS devices, it works as expected

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.

Some codes are generated by Claude Code under human supervision and verification
...


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/24310 **Author:** [@kao-byte](https://github.com/kao-byte) **Created:** 12/1/2025 **Status:** ✅ Merged **Merged:** 12/2/2025 **Merged by:** [@alextran1502](https://github.com/alextran1502) **Base:** `main` ← **Head:** `optimisation` --- ### 📝 Commits (5) - [`c56b7ca`](https://github.com/immich-app/immich/commit/c56b7ca11aab4cb496a4b39e1d87e85dd5c85f2c) fixed the timezone issue in the Immich mobile app's metadata sheet to match the web app's behavior - [`f1311c8`](https://github.com/immich-app/immich/commit/f1311c8ac07a934b895356c6bcfb93db582b4d95) format dart - [`697a6fb`](https://github.com/immich-app/immich/commit/697a6fba7d7091da1592c0c0ec04c3826e0f3852) now uses the shared applyTimezoneOffset() utility function from mobile/lib/utils/timezone.dart - [`7af2049`](https://github.com/immich-app/immich/commit/7af2049200ef3ef13a87ff17a953c942bc7f82c6) Merge branch 'main' of github.com:immich-app/immich into optimisation - [`70bd804`](https://github.com/immich-app/immich/commit/70bd804692f60b2f1bacec4a66a3df363204ae77) add tests ### 📊 Changes **5 files changed** (+345 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `mobile/lib/extensions/asset_extensions.dart` (+4 -17) 📝 `mobile/lib/presentation/widgets/asset_viewer/bottom_sheet.widget.dart` (+16 -6) 📝 `mobile/lib/services/action.service.dart` (+12 -3) ➕ `mobile/lib/utils/timezone.dart` (+35 -0) ➕ `mobile/test/utils/timezone_test.dart` (+278 -0) </details> ### 📄 Description ## 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. --> Fixes [#12650](https://github.com/immich-app/immich/discussions/12650?sort=new#discussioncomment-14570132) _**This fix does not change any behaviour regarding the handling of date & time at the server side.**_ With this fix, both the metadata display and edit dialog show dates in the actual timezone where photos were taken, matching the web app's behavior exactly, regardless of the mobile devices' current timezone setting. **1. mobile/lib/presentation/widgets/asset_viewer/bottom_sheet.widget.dart** Why: The metadata sheet was displaying dates in the device's system timezone instead of the timezone where the photo was actually taken. What changed: - Added imports for timezone package and duration_extensions - Rewrote the `_getDateTime()` method to use EXIF timezone information (dateTimeOriginal and timeZone fields) - Implemented the same timezone conversion logic as the web app, handling both named timezones (e.g., "Asia/Hong_Kong") and UTC offset formats (e.g., "UTC+08:00") - Updated the method signature to accept ExifInfo parameter - Changed timezone display format from manual string formatting to use `formatAsOffset()` extension with "GMT" prefix (same as the web app) **2. mobile/lib/services/action.service.dart** Why: The edit date/time dialog was also using the device's timezone when pre-filling the initial date, causing inconsistency between the displayed date and the editable date. What changed: - Added import for timezone package - Rewrote the `editDateTime()` method to apply EXIF timezone conversion before showing the date picker - Used a local non-nullable DateTime variable to handle transformations safely - Applied the same EXIF timezone logic as the display method to ensure consistency - Properly set both timeZone and offset parameters for the date picker ## 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 --> - Tested on real iOS devices, it works as expected <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. Some codes are generated by Claude Code under human supervision and verification ... --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 16:27:55 +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#17812