Skip to content

feat(site/src/components): add date-time range picker with quick picks - #28392

Merged
tracyjohnsonux merged 19 commits into
mainfrom
datetime-range-picker-mockup
Aug 20, 2026
Merged

feat(site/src/components): add date-time range picker with quick picks#28392
tracyjohnsonux merged 19 commits into
mainfrom
datetime-range-picker-mockup

Conversation

@tracyjohnsonux

@tracyjohnsonux tracyjohnsonux commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Adds a frontend-only DateTimeRangePicker component: a date range picker with quick picks (Last 15 min, Last hour, Today, This week) and per-boundary time selection. The dropdown opens as just the quick-pick list; the calendar and From/To time fields only appear after selecting "Custom range". Quick picks commit immediately, custom ranges commit via Apply.

No backend changes. The value is always resolved dates:

interface DateTimeRangeValue {
  start: Date;
  end: Date;
  preset?: string; // display metadata only, never sent to the backend
}

Quick picks resolve to concrete start/end at selection time; preset exists solely so the trigger can keep rendering the preset label. Consumers send start/end to the API in UTC via Date.toISOString().

Composed from existing primitives (Calendar, Popover, Select, Input, Button); the Calendar component is unchanged. Includes 9 Storybook stories with play-function coverage: quick-picks-only open state, immediate preset commit, custom panel expansion, apply flow, invalid time validation, end-before-start validation, and cancel discarding the draft.

Design notes and follow-ups

Mockup deviations

  • Added an Apply/Cancel footer to the custom panel. The design mockup does not show one, but a draft range needs an explicit commit point.
  • Trigger uses the shared Button outline variant to match the design system.

Settled decisions

  • The API receives resolved timestamps, not preset tokens.
  • All values sent to the backend are UTC; the component works in browser-local time and conversion happens at the API boundary.

Follow-ups (separate PRs)

  • Wire the component into the pages that need it, with query-param persistence where ranges should be shareable.
  • The existing DateTimeRangeFilter (text-expression based, used by the AIBridge sessions filter) is a candidate for migration to this design.
  • Possible polish per design feedback: masked/segmented time input, optional seconds, 24-hour locale support.

Generated by Coder Agents on behalf of @tracyjohnsonux.

Comment thread site/src/components/DateTimeRangePicker/dateTimeRange.ts
Comment thread site/src/components/DateTimeRangePicker/DateTimeRangePicker.stories.tsx Outdated
@jeremyruppel

Copy link
Copy Markdown
Contributor

super nit with no advice! I literally cannot think of a better place for the error to show, but this layout jump looks juuuuust a little weird to me:

Screen.Recording.2026-08-20.at.2.01.25.PM.mov

…rs on the calendar

Inline error messages grew the popover and shifted the layout. Errors now render as a single floating alert over the calendar's bottom edge, keeping the popover size stable. Stories use fn() for onChange so calls appear in the Storybook actions panel.

Copy link
Copy Markdown
Contributor Author

Fixed in 83c3c4a: validation errors now render as a single floating alert overlaid on the calendar's bottom edge instead of inline text, so the popover size stays fixed. The alert keeps role="alert" and the offending input's aria-describedby points at it.

Posted by Coder Agents on behalf of @tracyjohnsonux.

… ranges

A lone calendar click now forms a valid one-day range instead of leaving Apply disabled, and the To time defaults to 11:59:59 PM so day-only selections span the full final day rather than ending at its midnight.
… overlay

The floating validation message hides after five seconds like a toast. Invalid field styling and the disabled Apply button persist until the input is corrected, and a changed error message re-shows the overlay.
@tracyjohnsonux
tracyjohnsonux marked this pull request as ready for review August 20, 2026 21:42
Comment thread site/src/components/DateTimeRangePicker/DateTimeRangePicker.tsx Outdated
…able

react-day-picker marks nav buttons with aria-disabled rather than disabled, so they kept a pointer cursor and accepted no-op clicks. Disabled chevrons now also drop pointer events.
Args-based stories passed a frozen value, so committing a selection in the Storybook canvas never updated the trigger while the render-function stories did. A shared stateful render now backs every story, with onChange still spied through fn() for the actions panel.
@tracyjohnsonux tracyjohnsonux changed the title feat(site/src/components/DateTimeRangePicker): add date-time range picker with quick picks feat(site/src/components): add date-time range picker with quick picks Aug 20, 2026

@jeremyruppel jeremyruppel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's pick some datetimes!

@tracyjohnsonux
tracyjohnsonux enabled auto-merge (squash) August 20, 2026 22:28
@tracyjohnsonux
tracyjohnsonux merged commit af05849 into main Aug 20, 2026
26 checks passed
@tracyjohnsonux
tracyjohnsonux deleted the datetime-range-picker-mockup branch August 20, 2026 22:32
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 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