Altinity / Altinity/altinity-sql-browser
chartTimeValue: DST transition hour can misplace/collide time-scale points (local-wall-clock parsing)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8
- Forks
- 2
- Avg merge
- 1h 34m
- Merged PRs (30d)
- 6
Description
Problem
chartTimeValue (src/core/chart-data.ts, added in #309/PR for the Chart.js
time scale) parses a ClickHouse Date/DateTime/DateTime64 cell's literal
wall-clock digits into a Date via the local-timezone constructor
(new Date(year, month-1, day, hour, min, sec, ms)), with no timezone
awareness — a deliberate simplification mirroring the existing chartLabel()
display convention ("show it exactly as the server wrote it").
On a browser running in a timezone that observes DST, this is ambiguous/lossy
right at the transition hour:
- Fall-back (repeated hour): a wall-clock time like
01:30:00occurs twice
(once in each UTC offset). If aDateTimecolumn has two distinct rows that
both render as"2026-11-01 01:30:00"(or if ClickHouse's session/column
timezone doesn't match the browser's and produces the same string for two
real instants),chartTimeValuecollapses them to the identical epoch — two
points overlap on the time axis instead of sitting ~1 hour apart, which is
exactly the "gaps show as gaps, no compression" guarantee the time scale
exists to provide. - Spring-forward (nonexistent hour): a wall-clock time like
02:30:00on
the spring-forward date doesn't exist locally; the JSDateconstructor
silently normalizes it to some other instant (engine-dependent) rather than
rejecting it.
Why deferred
Proper handling needs real timezone-aware epoch computation (knowing the
ClickHouse column's/session's timezone, not just the browser's), which is a
materially bigger feature than #309's scope (a genuine Chart.js time scale for
line/area charts). The current behavior degrades gracefully — worst case is
one mis-plotted hour per year on hosts observing DST, never a crash — and
matches the pre-existing display convention exactly, so it isn't a regression,
just a narrow known limitation worth tracking.
Suggested acceptance criteria
- Decide whether to accept the current local-wall-clock behavior long-term
(document it explicitly) or invest in timezone-aware parsing (needs a
source for the relevant timezone — ClickHouse session timezone via
system.settings/column type param, or a per-connection setting). - If accepted as-is, add a one-line doc note next to
chartTimeValue
referencing this issue so a future reader doesn't rediscover the same
ambiguity as a "bug."
Related
- #309 (Chart.js time scale for line/area charts — where
chartTimeValuewas added)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/core/chart-data.ts at chartTimeValue and review how the ClickHouse Date, DateTime, and DateTime64 literal values are converted for the Chart.js time scale. Decide whether to document the local-wall-clock limitation or pursue timezone-aware parsing; done means meeting one of the stated acceptance criteria and preserving the existing display convention.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- chart.js, typescript
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100