fix(site): stabilize date-dependent storybook snapshots#23657
fix(site): stabilize date-dependent storybook snapshots#23657ethanndickson merged 2 commits intomainfrom
Conversation
Replace dynamic date computations with fixed timestamps in stories and
add an optional now prop to DateRangePicker, TemplateInsightsControls,
and CreateTokenForm so stories can inject a deterministic clock without
global mocking.
- DateRangePicker: accept optional now prop, thread it through presets,
boundary normalization, and calendar disabled-date logic
- LicenseCard.stories: replace shifting dayjs().startOf('day') with
absolute timestamps (2000-01-01 for expired, 2099-01-01 for future)
- LicensesSettingsPage.stories: anchor createLicense helper to a fixed
STORY_NOW constant instead of bare dayjs() calls
- TemplateInsightsControls.stories: pass fixed now matching endDate
- CreateTokenPage: plumb now prop through to CreateTokenForm for the
visible expiration description text
- All fixed timestamps use noon UTC to avoid timezone boundary issues
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4685203cc1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
site/src/pages/AgentsPage/components/DateRangePicker/DateRangePicker.tsx
Show resolved
Hide resolved
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
site/src/pages/AgentsPage/components/DateRangePicker/DateRangePicker.tsx
Show resolved
Hide resolved
jaaydenh
left a comment
There was a problem hiding this comment.
Looks good, just needs a story for DateRangePicker to consume the new "now" prop
…ion time and pin stories
Recompute now at commit/preset click time so toBoundary always uses a
fresh clock in production. When the now prop is provided (stories), the
injected value is still used for determinism.
Also pass now={fixedNow.toDate()} through all DateRangePicker stories
so calendar grid and preset behavior are snapshot-stable.
Generated by mux but reviewed by a human
Several stories computed dates relative to
dayjs()/new Date()at render time, causing snapshot text to shift daily. I ran into this on my PRs.This adds an optional
nowprop toDateRangePicker,TemplateInsightsControls, andCreateTokenFormso stories can inject a deterministic clock without global mocking. License stories replace the misleadingly-namedFIXED_NOW = dayjs().startOf("day")with absolute timestamps. All fixed timestamps use noon UTC to avoid timezone boundary issues.Affected stories:
AgentSettingsPageView: Usage Date Filter, Usage Date Filter Refetch OverlayLicenseCard: Expired/future AI Governance variants, Not Yet ValidLicensesSettingsPage: Shows Addon Ui For Future License Before NbfTemplateInsightsControls: DayCreateTokenPage: Default