Selection, time, and output
Choose the selected value shape, add time, and serialize it for an API.
Use this page after your first picker when the default
single Date value is not enough. Set mode on Calendar or DatePicker; it
defaults to "single".
| Mode | Public value | Behavior |
|---|---|---|
single | Date | null | Select one date. |
multiple | Date[] | Select and toggle individual dates. |
range | { start, end } | Select a start then an end; order is normalized. |
week | { start, end } | Select the full locale-relative week. |
month | { start, end } | Select the complete month containing the clicked day. |
quarter | { start, end } | Select the calendar quarter containing the clicked day. |
year | { start, end } | Select the complete calendar year. |
For span modes, end is null only while a range selection is incomplete.
Range
Click a first date and then a second date. While choosing the end, hovering a
date previews the span. Use numberOfMonths to display adjacent months.
Use minRange and maxRange to constrain the inclusive length of a range. The
selected endpoint and hover preview are clamped to the closest allowed span.
Multiple dates
max limits the number of selected dates. Reaching it leaves the existing
selection unchanged until the user deselects one.
Complete spans
Week, month, quarter, and year modes calculate both boundaries immediately. They are useful when an API expects a date range but the user should select one logical period.
week starts according to weekStartsOn (or the locale default).
Month and year views
MonthPicker and YearPicker are standalone views. They force month and
year selection respectively, while accepting the familiar calendar props.
Time
TimeField (also exported as TimePicker) is a standalone wall-clock control;
it does not require a date picker:
Available presentations are "field" (default), "wheel", and "analog".
The field variant supports seconds; use minuteStep and secondStep to change
arrow-key increments. Add withTime to DatePicker to show a date-first,
then-time flow:
Send a value to a form or API
Use onChange when your React code needs a Date, date array, or range. Add
onOutputChange only when another system needs a formatted string or JSON.
Set outputFormat="json" when the receiver expects JSON. Do not format the
value yourself unless that system requires a different convention.
Constraints apply to every mode
All modes accept the same constraints. For example, allow only future weekdays:
Next: constrain available dates and add holidays, or read the API Reference for the full prop list.