Repository navigation
fix(data): charts read dates the same on the server and in the browser - #541
Merged
lorant-one merged 1 commit intoNov 17, 2026
Merged
Conversation
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
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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")withformat: "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), whilenew Date("2025-01-01"), which is what people write fordate.start, is midnight UTC. The two only agreed in UTC.How: a new
utils/chartDate.tsreads a date-only string as midnight UTC, the same waynew 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,formatDateformats 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