Fix legislation action dates displaying one day early - #203
Conversation
Action dates are stored as UTC midnight (via new Date(dateString) .toISOString() on a bare YYYY-MM-DD input), but the timeline rendered them with toLocaleDateString() in the browser's local timezone, which rolls UTC midnight back to the previous local day in any timezone behind UTC. Force UTC when formatting for display, matching the pattern already used correctly in the public legislation search page. Fixes #200
|
Fix looks right for this page, but it may only cover half the bug. The public legislation detail page ( |
|
Took a look — good catch to double-check, but tracing it through, this turns out not to be a second instance of the bug. The admin-page bug (this PR) was in how the date got displayed, not how it's stored. >>> M(d='2026-04-07T00:00:00.000Z')
M(d=date(2026, 4, 7))
>>> M(d='2026-04-07T00:00:00.000Z').model_dump_json()
'{"d":"2026-04-07"}'
So Also merged latest |
Summary
new Date(dateString).toISOString()on a bareYYYY-MM-DDinput from the date picker).toLocaleDateString()with no timezone, which uses the browser's local timezone — for any US timezone (behind UTC), UTC midnight rolls back to the previous local day.timeZone: "UTC", matching the pattern already used correctly on the public legislation search page.Fixes #200
Test plan
tsc --noEmitpasses