Skip to content

[Bug] Fix timezone drift, respect locale + user date-time-locale across pickers#3646

Merged
markus-moser merged 9 commits into
2025.4from
fix/issue-1055-date-field-timezone-handling
Jun 1, 2026
Merged

[Bug] Fix timezone drift, respect locale + user date-time-locale across pickers#3646
markus-moser merged 9 commits into
2025.4from
fix/issue-1055-date-field-timezone-handling

Conversation

@markus-moser

@markus-moser markus-moser commented May 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #1055, #1056, and activates the long-unused user.dateTimeLocale profile setting.

#1055 — wall-clock fields (respectTimezone:false, columnType:'date') were read as browser-local instants and drifted by the browser↔server offset. Threads server timezone + respectTimezone semantics through editor, grid preview, filter, inline edit, and batch edit via dayjs.tz(). Batch edit moved to the data-object date/datetime abstract type so asset metadata is untouched.

#1056 — filter pickers were hardcoded to 'YYYY-MM-DD'. Now use the same Intl-based locale-aware fallback as the editor.

Locale resolutionformatDateTime now resolves locale via: explicit lnguser.dateTimeLocaleIntl.resolvedOptions().locale (OS region) → i18n.language. English-UI users in non-US regions will see their OS region's format unless they set the profile dropdown.

Backend companion: pimcore/studio-backend-bundle#1864.

@markus-moser markus-moser force-pushed the fix/issue-1055-date-field-timezone-handling branch 3 times, most recently from 853b127 to cb90bab Compare May 29, 2026 10:13
@markus-moser markus-moser changed the title [Bug] #1055 — align date/datetime field timezone handling with Pimcore semantics [Bug] Fix timezone drift in date/datetime fields May 29, 2026
@markus-moser markus-moser force-pushed the fix/issue-1055-date-field-timezone-handling branch from 385a35f to b33c22f Compare May 29, 2026 10:35
…ickers

Fixes #1055 and #1056.

#1055 — Date/datetime fields with respectTimezone=false (or date columnType:'date')
are wall-clock values anchored to the configured server timezone. Studio was reading
them as browser-local instants, so the displayed wall-clock drifted by the
browser↔server offset on every reload. Wires useSettings().timezone and the
respectTimezone semantics through the detail editor, grid cell preview, grid filter,
inline edit, and batch edit (the latter via getBatchEditComponent on the data-object
date/datetime abstract type).

#1056 — Grid filter date pickers displayed values in hardcoded 'YYYY-MM-DD' format
regardless of the user's locale. Replaced the explicit format prop with a
formatDisplayValue fallback (Intl, locale-aware) for both DatePicker and
DateRangePicker, so the filter inputs now follow the user's locale like the editor
already does.

Backend companion: pimcore/studio-backend-bundle#1864.
@markus-moser markus-moser force-pushed the fix/issue-1055-date-field-timezone-handling branch from 74409f6 to 686bb9a Compare May 29, 2026 11:47
@markus-moser markus-moser changed the title [Bug] Fix timezone drift in date/datetime fields [Bug] Fix timezone drift in date/datetime fields; respect locale in filter pickers May 29, 2026
markus-moser and others added 2 commits May 29, 2026 11:51
Wire the existing user profile "Date Time Locale" setting into formatDateTime so it
actually controls how dates render. Resolution chain: explicit lng arg → user.dateTimeLocale
→ Intl.DateTimeFormat().resolvedOptions().locale → i18n.language. The OS-region fallback fixes
the case where a user picks an English UI but is in a non-en-US region (Austria, Germany, …)
and was unexpectedly seeing en-US date order.

Also replaces the duplicated local formatDate in version-id-cell.tsx with the shared util so
that surface picks up the same treatment.
@markus-moser markus-moser changed the title [Bug] Fix timezone drift in date/datetime fields; respect locale in filter pickers [Bug] Fix timezone drift, respect locale + user date-time-locale across pickers Jun 1, 2026
The respect=false wire format ('YYYY-MM-DDT00:00:00Z') made the filter's display
round-trip drop a day in browsers west of UTC: dayjs(stored).startOf('day') parses the
Z-marked instant in browser-local time, which moves the picker's value to the previous
calendar day after any re-render.

Adds parseFilterDate as the inverse of formatFilterDate — slices the calendar prefix
from the stored value and rebuilds a browser-local midnight timestamp, so the picker
re-shows the same day the user clicked regardless of host TZ. Locked down with
round-trip tests against both wire formats (Z marker and signed offset).
@markus-moser markus-moser force-pushed the fix/issue-1055-date-field-timezone-handling branch from d0a2e1c to a1b937c Compare June 1, 2026 16:04
markus-moser and others added 4 commits June 1, 2026 16:06
The data-object batch-edit resolver picks DynamicTypeBatchEditDataObjectAdapter first
(via batchEdit.type='dataobject.adapter') and that adapter already renders the field's
getObjectDataComponent, which is the tz-aware DatePicker. The override I added on the
ObjectData registry was never reached, so removing it and DateObjectBatchEditComponent.
@sonarqubecloud

sonarqubecloud Bot commented Jun 1, 2026

Copy link
Copy Markdown

@markus-moser markus-moser marked this pull request as ready for review June 1, 2026 16:26
@markus-moser markus-moser merged commit 78a69b6 into 2025.4 Jun 1, 2026
1 check passed
@markus-moser markus-moser deleted the fix/issue-1055-date-field-timezone-handling branch June 1, 2026 16:26
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant