fix(server): render storage template date/time tokens in UTC (#24350)#26917
fix(server): render storage template date/time tokens in UTC (#24350)#26917danieldietzler merged 4 commits intoimmich-app:mainfrom
Conversation
can you explain how this is implemented for the end user? |
|
I now see that this phrase is a bit confusing. In my solution, based on what was discussed in the Immich Discord "Storage Template dates/times not adjusted for timezone", there is currently no way for the end user to change this behavior. I was referring to what one of the maintainers mentioned that this PR could be discussed and we could decide to switch to another time zone if needed. |
|
Got it. As I mentioned on the discord, I am personally not in favor of this change not being configurable. Additionally, unless it’s configurable with the default option being the current behavior, this would probably be a breaking change and have to wait for immich v3. |
|
I think an additional solution to explore is to provide the timezone as a storage template flag. I think applying UTC to all assets as a blanket policy is too restrictive. |
|
I fully understand the concern about it not being configurable. If this is the prefereble way to do it am happy to update my pr to implemment it. Also I did it in this way using UTC because it seemed like the simplest deterministic approach, and it was suggested on the discord. |
|
Just bumping this thread since v3 is approaching, I wanted to check how we should proceed with this PR, or implementing the suggested configurable timezone solution for this PR, or hold off for now. Happy to adapt the implementation based on the preferred direction. |
|
Hey, sorry for the delay. We wouldn't want completely customizable time zones at the moment, ideally more options for the storage template will be possible when workflows and plugins are released and went through a couple of iterations. Instead of using UTC, would you be able to change it to always use the server's TZ? |
Hey, no worries! Working on it! |
DateTime.fromJSDate()
a8a2401 to
3c8b010
Compare
|
Hey @danieldietzler, thanks for the review! I have already pushed the small change to the docs you asked. Let me know if everything looks good, or if you need anything else from my end! |
|
Yep, I saw. We were just waiting with merging PRs while some patch releases went out :) |
Description
Storage template dates and time were previously rendered using a local server system timezone context, which could produce non-chronological filenames when assets were taken across time zones for example Berlin to London travel like the example given on the issue. This pr changes the behavior so it always renders storage-template standard by using UTC. As asked by the maintainers on the discord Storage Template dates/times not adjusted for timezone it can be easely changed to different default time zone.
Fixes #24350
How Has This Been Tested?
2025-12-02T14:00:00.000Z(Berlin metadata)2025-12-02T14:00:00.000Z(Berlin metadata){{y}}{{MM}}{{dd}}_{{HH}}{{mm}}{{ss}}/{{filename}}Screenshots (if appropriate)
Checklist:
src/services/uses repositories implementations for database calls, filesystem operations, etc.src/repositories/is pretty basic/simple and does not have any immich specific logic (that belongs insrc/services/)Please describe to which degree, if any, an LLM was used in creating this pull request.
Github Copilot was used to have an overall understading of the codebase and to explain how the tests were made. Chatgpt was used to correct my grammer on the text of this PR.
...