[6.x] Fix date-only formats shifting days due to timezone conversion#14552
Open
duncanmcclean wants to merge 1 commit into6.xfrom
Open
[6.x] Fix date-only formats shifting days due to timezone conversion#14552duncanmcclean wants to merge 1 commit into6.xfrom
duncanmcclean wants to merge 1 commit into6.xfrom
Conversation
Date fields with formats that don't contain time (e.g. Y-m-d) were being unnecessarily converted through UTC, causing days to shift depending on the user's browser timezone. A date like 2024-12-25 could appear as December 24th for users in negative UTC offsets. Date-only formats now bypass timezone conversion entirely, flowing as plain Y-m-d strings between backend and frontend using CalendarDate objects that have no timezone information. Fixes #14413 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request fixes an issue where date fields with formats that don't contain time (e.g.
Y-m-d) would shift days depending on the user's browser timezone.For example: a user in Amsterdam selecting
2026-12-25would actually save as2026-12-24due to negative UTC offsets.This was happening because all dates — including date-only values — were being converted to UTC, then localized into the browser's timezone.
For a date like
2026-12-25stored with formatY-m-d, the value would be interpreted as2026-12-25T00:00:00in the app timezone, converted to a Zulu string, then localized to the browser's timezone, potentially shifting the day.This PR fixes it by bypassing timezone conversion entirely when the save format doesn't contain time characters. Date-only values now flow as plain
Y-m-dstrings between the backend and frontend, usingCalendarDateobjects that carry no timezone information.Fixes #14413