Skip to content

fix(data): charts read dates the same on the server and in the browser - #541

Merged
lorant-one merged 1 commit into
feat/3-0-breaking-cleanupfrom
feat/3-0-breaking-cleanup-giduz4
Nov 17, 2026
Merged

lorant-one merged 1 commit into
feat/3-0-breaking-cleanupfrom
feat/3-0-breaking-cleanup-giduz4

Conversation

@lorant-one

Copy link
Copy Markdown
Member

Before: outside UTC, a chart with a date range rendered different rows in the browser than on the server, so the page threw React's hydration error #418 and re-rendered. On the docs' /data/interaction page in Budapest, the January 2025 row was dropped from a range starting on 1 January. West of Greenwich, new Date("1980-01-01") with format: "yyyy" was labelled 1979.

After: every data page renders without a hydration error in Budapest, New York and Tokyo. The interaction example shows all 12 months.

Why: a date-only string like "2025-01-01" was parsed at local midnight (parseISO), while new Date("2025-01-01"), which is what people write for date.start, is midnight UTC. The two only agreed in UTC.

How: a new utils/chartDate.ts reads a date-only string as midnight UTC, the same way new Date() does. It writes a calendar day (midnight UTC) as that day in every time zone. Dates with a time still show in the reader's time zone. LineChart, LineBarChart, BarChart and PieChart filter with it, formatDate formats with it, and the screen-reader summary uses UTC for calendar days. Tests cover UTC, Budapest, New York and Auckland.

Checks: the full core test suite passes (4,698 tests, run in Europe/Budapest). tsc is clean, and the lint gate is at baseline (116). The docs build passes, and the data pages were checked in a browser in three time zones.

Note: next.docs.once-ui.com still serves a 3.0 build from early November (#403), because the core-docs project no longer builds this branch. The /data/setup error reported there comes from an example that the current docs no longer have.


Generated by Claude Code

A date-only string was parsed at local midnight while new Date("2025-01-01")
is midnight UTC, so outside UTC a date range dropped its first row and the
browser rendered different rows from the server (React #418 on the docs'
interaction page in Budapest). Calendar days now parse and format as UTC
days everywhere; dates with a time keep the reader's time zone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YJHdG7ZbpQS64MtL5PVbT1
@lorant-one
lorant-one merged commit 431f57d into feat/3-0-breaking-cleanup Nov 17, 2026
12 of 13 checks passed
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.

2 participants