Forms
IDateRangePicker
A two-month calendar for picking a span — a reporting period, a filter window, a stay. The model is a pair of ISO YYYY-MM-DD strings, like IDatePicker.
Both ends are null while nothing is chosen, and the first click sets start with end still null. Guard on period.end before querying with the range.
Presets
presets puts shortcuts beside the calendar. Picking one fills the range and closes the picker. commonDateRangePresets() builds the usual set: today, yesterday, the last 7 and 30 days, this month and last month, all relative to today in the viewer's time zone.
The preset matching the current range is highlighted, and any preset that falls outside min or max is disabled. Pass labels to translate the built-in set, or write your own presets. A function range is re-run every time the picker opens, so relative presets never go stale.
const presets = [
...commonDateRangePresets({ today: 'Danes', yesterday: 'Včeraj' }),
{ label: 'Q3 2026', range: { start: '2026-07-01', end: '2026-09-30' } },
]Months shown
Two months side by side is the default, since most ranges cross a month boundary. Drop to one where the popover has no room, or go to three for long ranges.
On screens narrower than Tailwind's sm breakpoint (40rem), the picker shows one month whatever months says, since two side by side won't fit a phone.
Bounds
Formatting and separator
format takes Intl.DateTimeFormatOptions and applies to both ends; separator is the text between them.
Locale and week start
clearLabel, previousLabel and nextLabel are props as well.
Clearable
Clearing sets both ends back to null.
Sizes
Invalid
Props
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'sm' | 'md' | 'lg' | 'md' | Control scale |
placeholder | string | 'Pick a date range' | Shown while nothing is selected |
disabled | boolean | — | Trigger cannot be opened |
invalid | boolean | — | Red border and ring; inherited from IFormField when unset |
id | string | — | Id for the trigger; IFormField supplies one |
min | string | — | Earliest selectable date, ISO YYYY-MM-DD |
max | string | — | Latest selectable date, ISO YYYY-MM-DD |
locale | string | — | Month names, weekday initials and trigger text |
format | Intl.DateTimeFormatOptions | — | How each end reads on the trigger |
weekStartsOn | 0–6 | — | 0 is Sunday. Defaults to the locale's convention |
months | number | 2 | Months shown side by side; always one on narrow screens |
presets | DateRangePreset[] | — | Shortcuts beside the calendar |
presetsLabel | string | 'Presets' | Accessible name for the preset list |
clearable | boolean | — | Adds a clear action to the footer |
separator | string | ' – ' | Text between the two dates on the trigger |
clearLabel | string | 'Clear' | Clear action label |
previousLabel | string | 'Previous month' | Accessible name for the back arrow |
nextLabel | string | 'Next month' | Accessible name for the forward arrow |
unstyled | boolean | — | Drop built-in classes |
class | string | — | Applied to the trigger, which carries the field chrome |
ui | { trigger?, placeholder?, content?, panel?, presets?, preset?, header?, heading?, nav?, months?, grid?, headCell?, cell?, cellTrigger?, footer?, action? } | — | Per-element class overrides |
Model
interface DateRange {
start: string | null
end: string | null
}The popover closes once both ends are set.