[Bug] Fix timezone drift, respect locale + user date-time-locale across pickers#3646
Merged
Merged
Conversation
853b127 to
cb90bab
Compare
385a35f to
b33c22f
Compare
…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.
74409f6 to
686bb9a
Compare
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.
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).
d0a2e1c to
a1b937c
Compare
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.
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



Fixes #1055, #1056, and activates the long-unused
user.dateTimeLocaleprofile 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 +respectTimezonesemantics through editor, grid preview, filter, inline edit, and batch edit viadayjs.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 resolution —
formatDateTimenow resolves locale via: explicitlng→user.dateTimeLocale→Intl.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.