Design the picker around date-only domain values, not timestamps. Keep the committed range separate from the visible month and draft hover state. Format dates for the reader's locale, validate static constraints in the browser, and let the server decide changing business availability at commit time.
A calendar looks like a grid of buttons, but the hard problems sit underneath it. A birthday does not become a different day when a person travels. A hotel stay has a start and end rule. A booking date that looked free ten seconds ago may no longer be available.
The design needs clean boundaries between value, presentation, interaction, and business policy.
Start with the value type
Use a date-only value for date-only products. An ISO calendar date such as 2026-10-12 or Temporal.PlainDate can represent the user's intent without an accidental time zone conversion.
Keep these states separate:
- Committed value: the date or range the surrounding form owns.
- Draft selection: the first range endpoint and current preview before commit.
- View state: visible month, focused day, and open state.
- Constraint snapshot: the rules currently known by the browser.
The visible month can change without changing the value. Hovering a possible end date can change the preview without committing it. A fresh server response can change availability without moving keyboard focus.
The public interview prompt
Design a reusable date picker and date-range picker for a frontend component platform. Explain:
- date-only identity, committed and draft range state, and form serialization;
- month navigation, keyboard movement, pointer and touch input, and focus restoration;
- minimum, maximum, disabled, blackout, lead-time, and changing availability rules;
- locale formatting, first day of week, right-to-left layout, and alternate calendars;
- loading, stale, conflict, offline, invalid, and partial range states;
- browser and service contracts, security, observability, testing, rollout, and evolution.
Assume the service can return availability for a bounded date interval and validates the final submission. The first version does not include free-form natural-language date parsing, time-of-day selection, recurring schedules, or collaborative booking.
What the premium solution covers
The complete solution defines a typed date model, controlled component API, range state machine, locale-aware calendar projection, keyboard grid contract, constraint precedence, interval availability API, cache keys, stale-response guards, conflict recovery, accessible announcements, mobile layout, performance budgets, security rules, telemetry, deterministic tests, rollout gates, and an interview scoring rubric.
Original desktop and mobile media show the range lifecycle and the difference between stored date values and rendered calendar labels. A deterministic lab lets you reverse the endpoints and compare rejection with clamping without sending any protected content to a non-Premium browser.