Skip to content

Preserve explicit epoch-zero bounds on time scales - #12360

Open
hakarrr wants to merge 2 commits into
chartjs:masterfrom
hakarrr:fix/preserve-epoch-zero-time-bounds
Open

hakarrr wants to merge 2 commits into
chartjs:masterfrom
hakarrr:fix/preserve-epoch-zero-time-bounds

Conversation

@hakarrr

@hakarrr hakarrr commented Oct 25, 2026

Copy link
Copy Markdown

Summary

With bounds: 'ticks', time scale tick generation uses this._userMin || timestamps[0] and the equivalent expression for max. Unix epoch zero is a valid explicit bound, but is falsey, so the first/last tick replaces it.

For example, a time axis with labels [1000, 2000], min: 0, bounds: 'ticks' and ticks.source: 'labels' ends up with scale.min === 1000, clipping the requested interval before the first label. The mirrored max: 0 case with negative timestamps is affected too, including the inherited timeseries scale.

Use the existing null/undefined helper to distinguish absent parsed bounds from zero. This keeps the fallback for missing bounds, which the time parser represents as null, without changing timestamp generation or pixel-offset behavior.

Tests

Eight chart-level cases cover time/timeseries, min/max equal to zero, and label/automatic tick sources. Four label-source cases fail on unchanged master 71d4421; all eight pass with the fix. The automatic-source cases are controls.

Validation in a separate exact-master tree, without the changes from #12358 or #12359:

  • All 135 time/timeseries browser tests pass.
  • Full ChromeHeadless suite: 1711 tests pass.
  • Rollup build passes.
  • Changed-file ESLint has zero errors. The two added null checks make buildTicks complexity 11 (threshold 10); the existing _generate complexity-12 warning remains.

Firefox and package integration tests were not run. This is separate from #12289's inverse pixel-offset correction.

hakarrr and others added 2 commits October 25, 2026 23:31
Co-authored-by: generaltony007 <144252170+GeneralTony007@users.noreply.github.com>
Co-authored-by: generaltony007 <144252170+GeneralTony007@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

1 participant