[Bug] Time axis day ticks shift to 01:00 and get hour labels after a midnight DST change
Version
6.1.0 (also master 34f4d92)
Link to Minimal Reproduction
Not applicable: the bug needs the page's local time zone to have a DST change at midnight (for example Atlantic/Azores), which an online editor cannot set; the Node script below sets it with TZ.
Steps to Reproduce
npm i [email protected]- Save as
repro.cjsand runTZ=Atlantic/Azores node repro.cjs:
// Run with: TZ=Atlantic/Azores node repro.cjs
const echarts = require('echarts');
const chart = echarts.init(null, null, {renderer: 'svg', ssr: true, width: 600, height: 300});
chart.setOption({
animation: false,
xAxis: {type: 'time'},
yAxis: {type: 'value'},
series: [{type: 'line', data: [[Date.parse('2026-03-26T12:00Z'), 1], [Date.parse('2026-04-03T00:00Z'), 2]]}]
});
for (const l of chart.getModel().getComponent('xAxis').axis.getViewLabels()) {
console.log(new Date(l.tick.value).toString().slice(0, 24), JSON.stringify(l.formattedLabel));
}
chart.dispose();
Current Behavior
Thu Mar 26 2026 11:00:00 "11:00"
Fri Mar 27 2026 00:00:00 "27"
Sat Mar 28 2026 00:00:00 "28"
Sun Mar 29 2026 01:00:00 "01:00"
Mon Mar 30 2026 01:00:00 "01:00"
Tue Mar 31 2026 01:00:00 "01:00"
Wed Apr 01 2026 00:00:00 "{primary|Apr}"
Wed Apr 01 2026 01:00:00 "01:00"
Thu Apr 02 2026 00:00:00 "2"
Fri Apr 03 2026 00:00:00 "3"
On Mar 29 local midnight does not exist (00:00 jumps to 01:00). From that day on every day tick until the end of the month sits at 01:00 and is labeled "01:00" instead of the day number, and there is an extra tick at Apr 01 01:00.
Expected Behavior
Day ticks at the start of each local day (01:00 only on Mar 29, where 00:00 does not exist), labeled "27", "28", "29", "30", "31", "{primary|Apr}", "2", "3", and no tick at Apr 01 01:00.
Environment
- OS: Debian 12, TZ=Atlantic/Azores
- Browser: none (Node.js 26.13.0, SSR)
- Framework: none
Any additional comments?
addTicksInSpan in src/scale/Time.ts steps one Date with date[setMethodName](date[getMethodName]() + interval), so after the DST day the wall time stays at 01:00. createIntervalTicks then picks each tick's unit with getUnitFromValue(tick.value, isUTC), which checks the hour, so a 01:00 day tick is treated as an hour tick. Computing each tick from the span start (or resetting the time after setDate) and taking the unit from the level would fix both.
Credit: https://ucsbplse.github.io/
Expected Behavior Day ticks at the start of each local day (01:00 only on Mar 29, where 00:00 does not exist), labeled "27", "28", "29", "30", "31", "{primary|Apr}", "2", "3"
see if useUTC: true solves the problem - Demo.
Thu Mar 26 2026 05:00:00 '12:00'
Thu Mar 26 2026 17:00:00 '27'
Fri Mar 27 2026 17:00:00 '28'
Sat Mar 28 2026 17:00:00 '29'
Sun Mar 29 2026 17:00:00 '30'
Mon Mar 30 2026 17:00:00 '31'
Tue Mar 31 2026 17:00:00 '{primary|Apr}'
Wed Apr 01 2026 17:00:00 '2'
Thu Apr 02 2026 17:00:00 '3'
Thanks for looking! useUTC: true avoids the shift, but then the ticks sit at UTC midnight (17:00 local in your output), so a chart shown in local time gets its day boundaries at the wrong hour. The bug is in the default local-time mode, where ticks after a midnight DST change move to 01:00 and get hour labels instead of day labels.
Hi, I'd like to work on this. In createIntervalTicks (src/scale/Time.ts) I'd reset day ticks to the local start of day after each setDate step, and take each tick's unit from its level rather than getUnitFromValue. I'll add a unit test that runs in Atlantic/Azores.