Skip to content

Fix DatePicker timezone handling for non-UTC app.timezone#2804

Open
baeroe wants to merge 1 commit intoarea17:3.xfrom
baeroe:fix/datepicker-timezone-utc
Open

Fix DatePicker timezone handling for non-UTC app.timezone#2804
baeroe wants to merge 1 commit intoarea17:3.xfrom
baeroe:fix/datepicker-timezone-utc

Conversation

@baeroe
Copy link
Copy Markdown

@baeroe baeroe commented Feb 12, 2026

Description

When app.timezone is 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 in app.timezone but the frontend always assumes UTC.

This PR fixes the issue by:

  • Always storing UTC in the databaseHandleDates::prepareDatesField() now calls ->utc() after Carbon::parse(), ensuring dates are converted to UTC before Eloquent writes them
  • Outputting UTC ISO 8601 to the frontend — Both _date_picker.blade.php and form.blade.php (publication dates) now format Carbon instances as ->utc()->toIso8601String(), giving the browser an unambiguous timestamp
  • Robust parseDate in 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) formats
  • Fixed PubAccordion.vuestartDateForDisplay now detects ISO 8601 strings with timezone info instead of blindly appending Z
  • Added non-UTC timezone browser tests — New FrontendDateConversionNonUtcTest and ScheduleDatesNonUtcTest verify correct behavior with app.timezone=Europe/Berlin

Related Issues

Fixes #2798

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 12, 2026

CLA assistant check
All committers have signed the CLA.

@baeroe baeroe force-pushed the fix/datepicker-timezone-utc branch from 4fb7eb0 to e0b5eb3 Compare February 12, 2026 12:22
@baeroe baeroe marked this pull request as draft February 12, 2026 12:23
@baeroe baeroe force-pushed the fix/datepicker-timezone-utc branch 2 times, most recently from c3b224b to f54cc59 Compare February 12, 2026 13:00
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>
@baeroe baeroe force-pushed the fix/datepicker-timezone-utc branch from f54cc59 to f495a23 Compare February 12, 2026 13:16
@baeroe baeroe marked this pull request as ready for review February 12, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DatePicker: Timezone offset applied incorrectly when parsing dates with time

2 participants