Skip to content

test: pin DateRangePicker calendar today to caller-supplied clock#24517

Merged
ethanndickson merged 1 commit into
mainfrom
date-picker-v4a5
Apr 20, 2026
Merged

test: pin DateRangePicker calendar today to caller-supplied clock#24517
ethanndickson merged 1 commit into
mainfrom
date-picker-v4a5

Conversation

@ethanndickson

@ethanndickson ethanndickson commented Apr 20, 2026

Copy link
Copy Markdown
Member

The DateRangePicker accepts a now prop that stories and tests use to pin preset ranges and future-date disabling to a deterministic clock, but it never forwarded that value to the underlying Calendar. react-day-picker then computed its own today from wall-clock time, which drives both the "today" highlight modifier and the initial visible month — causing stories like TemplateInsightsControls:Day to flake as real time advanced.

Thread currentTime into react-day-picker's today prop. When now is omitted (production usage), currentTime falls back to new Date(), which matches react-day-picker's existing default, so there is no runtime behavior change.

The DateRangePicker accepts a `now` prop that stories and tests use
to pin preset ranges and future-date disabling to a deterministic
clock, but it never forwarded that value to the underlying Calendar.
react-day-picker then computed its own `today` from wall-clock time,
which drives both the "today" highlight modifier and the initial
visible month, causing stories like `TemplateInsightsControls:Day`
to flake as real time advanced.
@ethanndickson ethanndickson changed the title fix(site): pin DateRangePicker calendar today to caller-supplied clock test: pin DateRangePicker calendar today to caller-supplied clock Apr 20, 2026
@ethanndickson ethanndickson marked this pull request as ready for review April 20, 2026 06:27
@ethanndickson ethanndickson requested a review from jakehwll April 20, 2026 06:27
@ethanndickson ethanndickson merged commit 596e55b into main Apr 20, 2026
42 checks passed
@ethanndickson ethanndickson deleted the date-picker-v4a5 branch April 20, 2026 06:36
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants