Skip to content

fix(data-table): serialize datetime filters as RFC 3339 - #546

Draft
IzumiSy wants to merge 5 commits into
mainfrom
fix/datetime-filter-rfc3339
Draft

IzumiSy wants to merge 5 commits into
mainfrom
fix/datetime-filter-rfc3339

Conversation

@IzumiSy

@IzumiSy IzumiSy commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Motivation

DataTable.Filters emitted local datetime strings without a timezone and passed them straight to GraphQL collection queries. Platform DateTime filters require RFC 3339 instants, so these values were not a reliable query contract.

Design Decision

Local-time selection, instant serialization

The picker continues to present the user's local date and time. On input it converts that local selection to an RFC 3339 UTC instant with Date#toISOString() rather than appending Z, which would change the selected instant. Existing instants are converted back to local picker parts when displayed.

Backward compatibility

Previously stored timezone-less datetime filters remain readable and are normalized when re-applied. Date and time filters retain their existing YYYY-MM-DD and HH:mm formats.

Summary

  • Serialize DataTable datetime filter values and ranges as RFC 3339 instants.
  • Render persisted datetime instants in the user's local timezone.
  • Document the filter contract and add regression coverage.

@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Code Metrics Report

main (45bdadf) #546 (7556043) +/-
Coverage 87.4% 87.7% +0.3%
Test Execution Time 2m11s 1m38s -33s
Details
  |                     | main (45bdadf) | #546 (7556043) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          87.4% |          87.7% | +0.3% |
  |   Files             |            204 |            204 |     0 |
  |   Lines             |           6014 |           6046 |   +32 |
+ |   Covered           |           5257 |           5305 |   +48 |
+ | Test Execution Time |          2m11s |          1m38s |  -33s |

Code coverage of files in pull request scope (79.7% → 83.1%, patch 79.6%)

Files Coverage +/- Patch Coverage Status
packages/core/src/components/data-table/filter-value-utils.ts 90.7% -4.9% 86.6% modified
packages/core/src/components/data-table/toolbar.tsx 82.5% +3.9% 77.2% modified

Reported by octocov

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Datetime handling remains inconsistent across configured timezones and operator changes, while permissive parsing can silently alter invalid values.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates DataTable datetime filters to use RFC 3339 instants while retaining local-time editing.

Changes:

  • Normalizes datetime values during editing and submission.
  • Displays persisted instants as local picker values.
  • Adds documentation, tests, and release metadata.
File summaries
File Description
packages/core/src/components/data-table/toolbar.tsx Applies datetime conversion in filter editors.
packages/core/src/components/data-table/toolbar.test.tsx Tests datetime serialization and ranges.
packages/core/src/components/data-table/filter-value-utils.ts Adds normalization and local-part helpers.
packages/core/src/components/data-table/filter-value-utils.test.ts Tests normalization and picker hydration.
docs/components/data-table.md Documents the RFC 3339 contract.
.changeset/bright-clocks-wait.md Records the patch-level behavior fix.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 75 to +76
const date = toValidDate(trimmed);
return date ? formatLocalDateTime(date) : undefined;
return date ? date.toISOString() : undefined;
Comment on lines +47 to +49
/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/.test(
trimmedValue,
) && toValidDate(trimmedValue) != null
Comment on lines +1957 to +1962
control.addFilter(
config.field,
localOp,
config.type === "datetime"
? normalizeTemporalFilterValue("datetime", localValue)
: localValue,
Copilot AI and others added 4 commits September 18, 2026 01:37
Co-authored-by: IzumiSy <982850+IzumiSy@users.noreply.github.com>
Co-authored-by: IzumiSy <982850+IzumiSy@users.noreply.github.com>
Co-authored-by: IzumiSy <982850+IzumiSy@users.noreply.github.com>
Co-authored-by: IzumiSy <982850+IzumiSy@users.noreply.github.com>
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.

3 participants