Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Date group title in web timeline confuses time zones #15634

Open
1 of 3 tasks
C-Otto opened this issue Jan 25, 2025 · 1 comment
Open
1 of 3 tasks

Date group title in web timeline confuses time zones #15634

C-Otto opened this issue Jan 25, 2025 · 1 comment
Labels
date-time Issues with date/time/time zone 🖥️web

Comments

@C-Otto
Copy link
Contributor

C-Otto commented Jan 25, 2025

The bug

See #12650 (comment) and #12650 (comment)

The date shown for the group may be "today" or "yesterday". This is determined based on the comparison of "now" and the asset's date, truncated to midnight (start of the day). During this, the asset date's local time is used (which is UTC from a technical point of view), whereas the browser time (now) might include time zone offset information. As a result of this, an asset created today, having the "localDateTime" of today, might be shown as "yesterday" or "tomorrow".

web/src/lib/utils/timeline-util.ts:98

Version of Immich Server

v1.125.2

Platform with the issue

  • Server
  • Web
  • Mobile

Reproduction steps

  • modify asset time to today's date, 00:00:00 in time zone Pacific/Honolulu
  • set server's time zone to Pacific/Honolulu (TZ in .env)
  • set browser system's time zone to Pacific/Honolulu timedatectl set-timezone Pacific/Honolulu
  • set local time to 13:59:00 date -s "2025-xx-yy 13:59:00"
  • see image show as "today"
  • wait until time is 14:00 (which is midnight UTC)
  • see image show as "yesterday"
@C-Otto C-Otto added 🖥️web date-time Issues with date/time/time zone labels Jan 25, 2025
@antoniosarro
Copy link
Contributor

antoniosarro commented Jan 29, 2025

Hello, I've investigated a bit and it seems like the problem is with the luxon library that's being used in this function web/src/lib/utils/timeline-util.ts:98-116. The line .toLocaleString(groupDateFormat, { locale }) doesn't take into account the system's locale settings.

I created some functions with the built-in Date to replace those that use luxon, and it seems like at least for my timezone (Europe/Rome) the problem is fixed. However, I'd like to check the library again to see if there are any known issues or changes that might be causing the problem.

I believe that, however, given that in the end the functions used in this library are always the same, they could be defined internally within the project ad-hoc, so as to have one less dependency that could break again.

I'll update as soon as I have news.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
date-time Issues with date/time/time zone 🖥️web
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants