librislog icon indicating copy to clipboard operation
librislog copied to clipboard

[Bug] Book detail freezes the browser when reading progress spans a DST fall-back

Open gitturtle697 opened this issue 4 weeks ago • 5 comments

v1.12.0.

When a book’s progress chart spans the US DST end (2026-11-01 01:00–02:00, America/New_York), opening the book detail dialog hangs the main thread (Firefox and Chromium-based browsers, desktop and Android).

Repro: Device time zone America/New_York, profile time zone America/New_York. Book started 2026-10-31 18:59 UTC, with progress entries on 2026-10-31 and 2026-11-01 17:04 UTC. Open the book and the tab hangs. The same data shifted to Oct 20–21 works fine.

Cause: In the Chart.js date adapter in frontend/src/lib/chartjs/register.ts, startOf('hour') and add(n, 'hour') go through dayjs.utc(t).tz(tz). Inside the repeated hour this goes backwards or never advances. For example, startOf('hour') of 2026-11-01T06:30Z returns 05:00Z. With a device in New York, add(1,'hour') from 05:00Z returns 05:00Z again. So Chart.js’s tick loop never ends. Making sub-day units (millisecond/second/minute/hour) never return a time earlier than the input, or doing that arithmetic on the epoch value, fixes it locally.

Related: If the profile time zone is set to UTC, it gets overwritten with the detected zone on the next login (login/+page.svelte, auth/oidc/callback/+page.svelte), so users can’t use UTC to work around this.

gitturtle697 avatar Nov 03 '26 03:11 gitturtle697

Hi @gitturtle697 will have a look into it later today. Usually this should be covered by a test case and my test suite returned no errors. But I'm confident to find it. Thanks for your bug report.

codebude avatar Nov 03 '26 06:11 codebude

Thanks for looking into it, @codebude . I appreciate your time and effort, and thanks for making a great app!

gitturtle697 avatar Nov 03 '26 10:11 gitturtle697

Hi @gitturtle697, this is fixed now in #130 . Thanks again for the very detailed report and for pointing at the chart adapter, that saved me quite some time.

The fix is in #130 and merged into develop. It will be part of the upcoming v1.12.1 patch release which I'm preparing right now and will publish in the next 30 minutes.

If you can, please give it a try once it is available and let me know if anything still reproduces.

codebude avatar Nov 03 '26 14:11 codebude

Will do, @codebude ! I'll check later this evening and will report back. Thank yiu!

gitturtle697 avatar Nov 03 '26 14:11 gitturtle697

That seems to have fixed it, @codebude , but will let you know if anything changes. Thanks!

gitturtle697 avatar Nov 03 '26 23:11 gitturtle697