From 596e55b13630b43decdfd40df9dbcfc6507dabcb Mon Sep 17 00:00:00 2001 From: Ethan <39577870+ethanndickson@users.noreply.github.com> Date: Mon, 20 Apr 2026 16:36:13 +1000 Subject: [PATCH] test: pin DateRangePicker calendar today to caller-supplied clock (#24517) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- site/src/components/DateRangePicker/DateRangePicker.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/site/src/components/DateRangePicker/DateRangePicker.tsx b/site/src/components/DateRangePicker/DateRangePicker.tsx index fa9494bcc7..d3dfa183fb 100644 --- a/site/src/components/DateRangePicker/DateRangePicker.tsx +++ b/site/src/components/DateRangePicker/DateRangePicker.tsx @@ -246,6 +246,7 @@ export const DateRangePicker: FC = ({ onSelect={handleCalendarSelect} numberOfMonths={2} disabled={{ after: currentTime }} + today={currentTime} />