Skip to content

time: preserve instants across timezone rule changes - #192

Open
dballagi wants to merge 1 commit into
t-mart:masterfrom
dballagi:fix/timezone-offset-mismatch
Open

dballagi wants to merge 1 commit into
t-mart:masterfrom
dballagi:fix/timezone-offset-mismatch

Conversation

@dballagi

@dballagi dballagi commented Nov 4, 2026

Copy link
Copy Markdown

Fixes a blank web UI when the backend and browser have different timezone rules, such as Vancouver's switch to permanent daylight saving time. A timestamp with the old -08:00 offset and [America/Vancouver] annotation causes strict Temporal parsing to throw in a browser expecting -07:00.

  • time: trust the recorded UTC offset when parsing timestamps, preserving the original instant rather than reinterpreting its wall time under the receiving runtime's timezone rules.
  • ui/state: share the parser for both countdown timestamps and saved-state loading, so timezone-data updates also cannot prevent reading existing state. The serialized format is unchanged; malformed timestamps still throw.
  • tests: cover offset mismatches, saved-state round trips, countdown rendering, and repeated DST wall times.

Validated with 25 targeted tests under both Bun and Node, production build, type-check, lint, and changed-file formatting. Also verified the production UI in-browser with the Vancouver offset mismatch: the countdown and cookie form render without errors. The repository-wide formatting check flags existing CRLF files on Windows; unrelated files were left untouched.

Trust explicit UTC offsets when parsing recorded timestamps in the UI
and saved state. Prevent crashes when server and browser timezone data
disagree, such as Vancouver's permanent daylight saving time.

Add regression tests for offset mismatches and countdown rendering.
@t-mart

t-mart commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Interesting bug. Thanks for the PR! (I wish my time stopped changing!)

I will carve out some time soon to review and hopefully incorporate this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants