Date Range Picker
Input for selecting a start and end date
Overview
Date Range Picker lets users choose a start and end date from a calendar. It renders as a Button showing the current range, which opens a Popover containing a month calendar with navigation.
Usage
Import the component:
import { DateRangePicker } from "@eqtylab/equality";Hold the range in state and pass it back through onSelect:
import { useState } from "react";
const [dateRange, setDateRange] = useState<{ from?: Date; to?: Date }>({});
<DateRangePicker dateRange={dateRange} onSelect={setDateRange} />;Both from and to are optional Date objects. from is the first moment of its day and to the last (23:59:59.999), so a completed range covers both selected days in full.
Time Zone
Days follow the browser’s time zone. When your app lets people pick their own, pass it as timeZone, an IANA name. The calendar’s today, the selected days, the trigger’s label and the from and to you get back then all follow that zone, so the range matches dates shown elsewhere in your app. An unknown zone name throws a RangeError, as Intl does, so check a stored preference before passing it.
<DateRangePicker
dateRange={dateRange}
onSelect={setDateRange}
timeZone="Europe/Paris"
/>Default
Props
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
dateRange | The currently selected range. { from, to } — both optional Date values. | { from?: Date; to?: Date } | — | ✅ |
onSelect | Called with the updated range whenever the user picks a date or clears the selection. | (range: { from?: Date; to?: Date }) => void | — | ✅ |
className | Additional CSS classes applied to the trigger button. | string | — | ❌ |
timeZone | IANA time zone the days follow, such as Europe/Paris. | string | Browser’s zone | ❌ |