Skip to content

Commit 596e55b

Browse files
test: pin DateRangePicker calendar today to caller-supplied clock (coder#24517)
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.
1 parent 7e89534 commit 596e55b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

site/src/components/DateRangePicker/DateRangePicker.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ export const DateRangePicker: FC<DateRangePickerProps> = ({
246246
onSelect={handleCalendarSelect}
247247
numberOfMonths={2}
248248
disabled={{ after: currentTime }}
249+
today={currentTime}
249250
/>
250251
</div>
251252

0 commit comments

Comments
 (0)