Fix DatePicker timezone handling for non-UTC app.timezone#2804
Open
baeroe wants to merge 1 commit intoarea17:3.xfrom
Open
Fix DatePicker timezone handling for non-UTC app.timezone#2804baeroe wants to merge 1 commit intoarea17:3.xfrom
baeroe wants to merge 1 commit intoarea17:3.xfrom
Conversation
4fb7eb0 to
e0b5eb3
Compare
c3b224b to
f54cc59
Compare
Always store dates as UTC in the database and output UTC ISO 8601 to the frontend, so that browser-local display is correct regardless of the app.timezone setting. Replace the length-based parseDate logic in DatePicker.vue with regex-based format detection that handles ISO 8601, European (dd.MM.yyyy) and US (MM/dd/yyyy) date formats. Fix PubAccordion.vue to handle ISO 8601 strings with timezone offsets. Fixes area17#2798 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
f54cc59 to
f495a23
Compare
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.
Description
When
app.timezoneis set to a non-UTC timezone (e.g.Europe/Berlin), the DatePicker applies timezone offsets incorrectly, causing a double-offset when loading dates. This happens because the backend stores dates inapp.timezonebut the frontend always assumes UTC.This PR fixes the issue by:
HandleDates::prepareDatesField()now calls->utc()afterCarbon::parse(), ensuring dates are converted to UTC before Eloquent writes them_date_picker.blade.phpandform.blade.php(publication dates) now format Carbon instances as->utc()->toIso8601String(), giving the browser an unambiguous timestampparseDatein DatePicker.vue — Replaced length-based format detection with regex-based matching that correctly handles ISO 8601 with timezone, ISO without timezone, date-only, European dot-separated (dd.MM.yyyy), and US slash-separated (MM/dd/yyyy) formatsPubAccordion.vue—startDateForDisplaynow detects ISO 8601 strings with timezone info instead of blindly appendingZFrontendDateConversionNonUtcTestandScheduleDatesNonUtcTestverify correct behavior withapp.timezone=Europe/BerlinRelated Issues
Fixes #2798