Skip to content

[Bug] Round system.datetime grid filter to whole day#1864

Merged
markus-moser merged 1 commit into
2025.4from
fix/issue-1055-system-date-filter-naive-tz
Jun 3, 2026
Merged

[Bug] Round system.datetime grid filter to whole day#1864
markus-moser merged 1 commit into
2025.4from
fix/issue-1055-system-date-filter-naive-tz

Conversation

@markus-moser
Copy link
Copy Markdown
Contributor

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

DateTimeFilter::apply passes roundToDay=false, so GDI collapses gte/lte to the same instant for on queries and never matches a stored datetime with a non-zero time component. The filter UI is date-only, so whole-day match is the right semantic — DateFilter (for system.date) already does this.

Companion to the timezone-handling fix in pimcore/studio-ui-bundle#3646.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 29, 2026

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@markus-moser markus-moser force-pushed the fix/issue-1055-system-date-filter-naive-tz branch 3 times, most recently from 260c4a9 to 5411acf Compare May 29, 2026 08:54
@markus-moser markus-moser changed the title [Grid] Align date/datetime filters with how naïve values are indexed [Grid] Fix system.datetime filter never matching non-midnight values May 29, 2026
`DateTimeFilter::apply` passed `roundToDay=false` to the trait, which makes
GDI's `DateFilter` collapse `gte` and `lte` to the same instant for `on`
queries — never matching a stored datetime with a non-zero time component.
The filter UI is date-only, so whole-day match is the right semantic.
`DateFilter` (for `system.date`) already passes `true`; this aligns
`DateTimeFilter`.
@markus-moser markus-moser force-pushed the fix/issue-1055-system-date-filter-naive-tz branch from 5411acf to dcd7d31 Compare May 29, 2026 09:16
@markus-moser markus-moser changed the title [Grid] Fix system.datetime filter never matching non-midnight values [Bug] Round system.datetime grid filter to whole day May 29, 2026
@sonarqubecloud
Copy link
Copy Markdown

markus-moser added a commit to pimcore/studio-ui-bundle that referenced this pull request May 29, 2026
…e semantics

Pimcore date/datetime fields have two timezone modes:
  - respectTimezone=true  → absolute instant, displayed in the browser timezone
  - respectTimezone=false → wall-clock anchored to the configured server timezone

Studio was reading respect=false fields with dayjs.unix() in browser-local time,
so the displayed wall-clock drifted by the browser↔server offset on reload. The
respect=true path already behaved correctly.

This wires useSettings().timezone + the field's respect-timezone semantics through
every surface where these fields are rendered or edited:

  - DatePicker.tsx: new respectTimezone prop; toDayJs(value, _, {respectTimezone,
    timezone}) anchors the input to the server wall-clock via dayjs.tz()
  - date-picker-utils.ts: toServerWallClock helper; formatFilterDate(timestamp,
    respectTimezone) emits ISO+offset for respect=true, UTC ISO of the picked
    calendar day for respect=false (aligns with the generic-data-index pipeline,
    which indexes naive date strings as UTC)
  - abstract/date/datetime object-data types: propagate respectTimezone; new
    DateGridCellPreview / DatetimeGridCellPreview render the grid cell with the
    server timezone when respect=false; fix datetime columnType union
  - date-time.ts: optional timeZone passed through to Intl
  - field-filter date component: reads field config via useDynamicFilter and
    uses formatFilterDate
  - batch-edit datetime component: reads field config from batchEdit and forwards
    respectTimezone + outputFormat + showTime to the shared DatePicker; same
    component handles both date and datetime since the backend FrontendType enum
    has a single DATETIME entry

Tests: 20 new Jest cases in date-picker-utils.test.ts (toServerWallClock /
toDayJs / fromDayJs / formatFilterDate) and 5 in date-time.test.ts (timeZone
forwarding to Intl). All pure-function tests, fast and host-tz-independent.

Companion PR in studio-backend-bundle: pimcore/studio-backend-bundle#1864.
markus-moser added a commit to pimcore/studio-ui-bundle that referenced this pull request May 29, 2026
…e semantics

Pimcore date/datetime fields have two timezone modes:
  - respectTimezone=true  → absolute instant, displayed in the browser timezone
  - respectTimezone=false → wall-clock anchored to the configured server timezone

Studio was reading respect=false fields with dayjs.unix() in browser-local time,
so the displayed wall-clock drifted by the browser↔server offset on reload. The
respect=true path already behaved correctly.

This wires useSettings().timezone + the field's respect-timezone semantics through
every surface where these fields are rendered or edited:

  - DatePicker.tsx: new respectTimezone prop; toDayJs(value, _, {respectTimezone,
    timezone}) anchors the input to the server wall-clock via dayjs.tz()
  - date-picker-utils.ts: toServerWallClock helper; formatFilterDate(timestamp,
    respectTimezone) emits ISO+offset for respect=true, UTC ISO of the picked
    calendar day for respect=false (aligns with the generic-data-index pipeline,
    which indexes naive date strings as UTC)
  - abstract/date/datetime object-data types: propagate respectTimezone; new
    DateGridCellPreview / DatetimeGridCellPreview render the grid cell with the
    server timezone when respect=false; fix datetime columnType union
  - date-time.ts: optional timeZone passed through to Intl
  - field-filter date component: reads field config via useDynamicFilter and
    uses formatFilterDate
  - batch-edit datetime component: reads field config from batchEdit and forwards
    respectTimezone + outputFormat + showTime to the shared DatePicker; same
    component handles both date and datetime since the backend FrontendType enum
    has a single DATETIME entry

Tests: 20 new Jest cases in date-picker-utils.test.ts (toServerWallClock /
toDayJs / fromDayJs / formatFilterDate) and 5 in date-time.test.ts (timeZone
forwarding to Intl). All pure-function tests, fast and host-tz-independent.

Companion PR in studio-backend-bundle: pimcore/studio-backend-bundle#1864.
markus-moser added a commit to pimcore/studio-ui-bundle that referenced this pull request May 29, 2026
…e semantics

Pimcore date/datetime fields have two timezone modes:
  - respectTimezone=true  → absolute instant, displayed in the browser timezone
  - respectTimezone=false → wall-clock anchored to the configured server timezone

Studio was reading respect=false fields with dayjs.unix() in browser-local time,
so the displayed wall-clock drifted by the browser↔server offset on reload. The
respect=true path already behaved correctly.

This wires useSettings().timezone + the field's respect-timezone semantics through
every surface where these fields are rendered or edited:

  - DatePicker.tsx: new respectTimezone prop; toDayJs(value, _, {respectTimezone,
    timezone}) anchors the input to the server wall-clock via dayjs.tz()
  - date-picker-utils.ts: toServerWallClock helper; formatFilterDate(timestamp,
    respectTimezone) emits ISO+offset for respect=true, UTC ISO of the picked
    calendar day for respect=false (aligns with the generic-data-index pipeline,
    which indexes naive date strings as UTC)
  - abstract/date/datetime object-data types: propagate respectTimezone; new
    DateGridCellPreview / DatetimeGridCellPreview render the grid cell with the
    server timezone when respect=false; fix datetime columnType union
  - date-time.ts: optional timeZone passed through to Intl
  - field-filter date component: reads field config via useDynamicFilter and
    uses formatFilterDate
  - batch-edit datetime component: reads field config from batchEdit and forwards
    respectTimezone + outputFormat + showTime to the shared DatePicker; same
    component handles both date and datetime since the backend FrontendType enum
    has a single DATETIME entry

Tests: 20 new Jest cases in date-picker-utils.test.ts (toServerWallClock /
toDayJs / fromDayJs / formatFilterDate) and 5 in date-time.test.ts (timeZone
forwarding to Intl). All pure-function tests, fast and host-tz-independent.

Companion PR in studio-backend-bundle: pimcore/studio-backend-bundle#1864.
markus-moser added a commit to pimcore/studio-ui-bundle that referenced this pull request May 29, 2026
…e semantics

Pimcore date/datetime fields have two timezone modes:
  - respectTimezone=true  → absolute instant, displayed in the browser timezone
  - respectTimezone=false → wall-clock anchored to the configured server timezone

Studio was reading respect=false fields with dayjs.unix() in browser-local time,
so the displayed wall-clock drifted by the browser↔server offset on reload. The
respect=true path already behaved correctly.

This wires useSettings().timezone + the field's respect-timezone semantics through
every surface where these fields are rendered or edited:

  - DatePicker.tsx: new respectTimezone prop; toDayJs(value, _, {respectTimezone,
    timezone}) anchors the input to the server wall-clock via dayjs.tz()
  - date-picker-utils.ts: toServerWallClock helper; formatFilterDate(timestamp,
    respectTimezone) emits ISO+offset for respect=true, UTC ISO of the picked
    calendar day for respect=false (aligns with the generic-data-index pipeline,
    which indexes naive date strings as UTC)
  - abstract/date/datetime object-data types: propagate respectTimezone; new
    DateGridCellPreview / DatetimeGridCellPreview render the grid cell with the
    server timezone when respect=false; fix datetime columnType union
  - date-time.ts: optional timeZone passed through to Intl
  - field-filter date component: reads field config via useDynamicFilter and
    uses formatFilterDate
  - batch-edit datetime component: reads field config from batchEdit and forwards
    respectTimezone + outputFormat + showTime to the shared DatePicker; same
    component handles both date and datetime since the backend FrontendType enum
    has a single DATETIME entry

Tests: 20 new Jest cases in date-picker-utils.test.ts (toServerWallClock /
toDayJs / fromDayJs / formatFilterDate) and 5 in date-time.test.ts (timeZone
forwarding to Intl). All pure-function tests, fast and host-tz-independent.

Companion PR in studio-backend-bundle: pimcore/studio-backend-bundle#1864.
markus-moser added a commit to pimcore/studio-ui-bundle that referenced this pull request May 29, 2026
…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 marked this pull request as ready for review June 3, 2026 08:48
@markus-moser markus-moser requested a review from lukmzig June 3, 2026 08:48
@markus-moser markus-moser added this to the 2025.4.5 milestone Jun 3, 2026
@markus-moser markus-moser merged commit 30d34f3 into 2025.4 Jun 3, 2026
12 of 13 checks passed
@markus-moser markus-moser deleted the fix/issue-1055-system-date-filter-naive-tz branch June 3, 2026 09:59
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 3, 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.

2 participants