DateRangePicker

A date range picker combines two DateFields and a RangeCalendar popover to allow users to enter or select a date and time range.

Theme 
Date range
 
granularity 
isDisabled 
Example
DateRangePicker.tsx
DateRangePicker.css
import {DateRangePicker} from './DateRangePicker';

<DateRangePicker label="Date range" />

Value

Use the value or defaultValue prop to set the selected date range, using objects in the @internationalized/date package. This library supports parsing date strings in multiple formats, manipulation across international calendar systems, time zones, etc.

Selected range: February 3 – 12, 2025

import {parseDate, getLocalTimeZone, type CalendarDate} from '@internationalized/date';
import {useDateFormatter, type RangeValue} from 'react-aria';
import {DateRangePicker} from './DateRangePicker';
import {useState} from 'react';

function Example() {
  let [range, setRange] = useState<RangeValue<CalendarDate> | null>({
    start: parseDate('2025-02-03'),
    end: parseDate('2025-02-12')
  });
  let formatter = useDateFormatter({ dateStyle: 'long' });

  return (
    <>
      <DateRangePicker
        value={range}
        onChange={setRange} />
      <p>Selected range: {range ? formatter.formatRange(
        range.start.toDate(getLocalTimeZone()),
        range.end.toDate(getLocalTimeZone())
      ) : '--'}</p>
    </>
  );
}

Format options

The date format is automatically determined based on the user's locale. DateRangePicker supports several props to control how values are displayed.

Date
granularity 
hourCycle 
hideTimeZone 
shouldForceLeadingZeros 
import {parseZonedDateTime} from '@internationalized/date';
import {DateRangePicker} from './DateRangePicker';

<DateRangePicker
  label="Date"
  defaultValue={{
    start: parseZonedDateTime('2025-02-03T08:45:00[America/Los_Angeles]'),
    end: parseZonedDateTime('2025-02-14T08:45:00[America/Los_Angeles]')
  }} />

International calendars

By default, DateRangePicker displays the value using the calendar system for the user's locale. Use <I18nProvider> to override the calendar system by setting the Unicode calendar locale extension. The onChange event always receives a date in the same calendar as the value or defaultValue (Gregorian if no value is provided), regardless of the displayed locale.

Locale
Calendar
import {I18nProvider} from 'react-aria-components';
import {parseDate} from '@internationalized/date';
import {DateRangePicker} from './DateRangePicker';

<I18nProvider locale="hi-IN-u-ca-indian">
  <DateRangePicker
    defaultValue={{
      start: parseDate('2025-02-03'),
      end: parseDate('2025-02-14')
    }} />
</I18nProvider>

Forms

Use the name prop to submit the selected date to the server as an ISO 8601 string. Set the isRequired, minValue, or maxValue props to validate the value, or implement custom client or server-side validation. The isDateUnavailable callback prevents certain dates from being selected. Use allowsNonContiguousRanges to allow selecting ranges containing unavailable dates. See the Forms guide to learn more.

Trip dates
allowsNonContiguousRanges 
import {isWeekend, today, getLocalTimeZone} from '@internationalized/date';
import {useLocale} from 'react-aria-components';
import {DateRangePicker} from './DateRangePicker';
import {Button} from './Button';
import {Form} from './Form';;

function Example(props) {
  let {locale} = useLocale();
  let now = today(getLocalTimeZone());
  let disabledRanges = [
    [now, now.add({ days: 5 })],
    [now.add({ days: 14 }), now.add({ days: 16 })],
    [now.add({ days: 23 }), now.add({ days: 24 })]
  ];

  return (
    <Form>
      <DateRangePicker
        {...props}
        label="Trip dates"
        startName="startDate"
        endName="endDate"
        isRequired
        minValue={today(getLocalTimeZone())}
        isDateUnavailable={date => (
          isWeekend(date, locale) ||
          disabledRanges.some((interval) =>
            date.compare(interval[0]) >= 0 && date.compare(interval[1]) <= 0
          )
        )}
      />
      <Button type="submit">Submit</Button>
    </Form>
  );
}

API

September 2021SMTWTF5789101314151619202122232412326272930628S111825412176Event dateGroupLabelButtonStart fieldEnd fieldRangeCalendarPopover9 / 17 / 20219 / 6 / 2021 –
<DateRangePicker>
  <Label />
  <Group>
    <DateInput slot="start" />
    <DateInput slot="end" />
    <Button />
  </Group>
  <Text slot="description" />
  <FieldError />
  <Popover>
    <RangeCalendar />
  </Popover>
</DateRangePicker>

DateRangePicker

NameTypeDefault
pageBehaviorDefault: visible
Controls the behavior of paging. Pagination either works by advancing the visible page by visibleDuration (default) or one unit of visibleDuration.
firstDayOfWeek'sun''mon''tue''wed''thu''fri''sat'Default:
The day that starts the week.
isDateUnavailable(date: ) => booleanDefault:
Callback that is called for each date of the calendar. If it returns true, then the date is unavailable.
placeholderValuenullDefault:
A placeholder date that influences the format of the placeholder shown when no value is selected. Defaults to today's date at midnight.
hourCycle1224Default:
Whether to display the time in 12 or 24 hour format. By default, this is determined by the user's locale.
granularityDefault:
Determines the smallest unit that is displayed in the date picker. By default, this is "day" for dates, and "minute" for times.
hideTimeZonebooleanDefault: false
Whether to hide the time zone abbreviation.
shouldForceLeadingZerosbooleanDefault:
Whether to always show leading zeros in the month, day, and hour fields. By default, this is determined by the user's locale.
isDisabledbooleanDefault:
Whether the input is disabled.
isReadOnlybooleanDefault:
Whether the input can be selected but not changed by the user.
allowsNonContiguousRangesbooleanDefault:
When combined with isDateUnavailable, determines whether non-contiguous ranges, i.e. ranges containing unavailable dates, may be selected.
children<>Default:
The children of the component. A function may be provided to alter the children based on component state.
value<>nullDefault:
The current value (controlled).
defaultValue<>nullDefault:
The default value (uncontrolled).
onChange(value: <<>>null) => voidDefault:
Handler that is called when the value changes.

Default className: react-aria-DateRangePicker

Render PropCSS Selector
stateCSS Selector:
State of the date range picker.
isFocusWithinCSS Selector: [data-focus-within]
Whether an element within the date picker is focused, either via a mouse or keyboard.
isFocusVisibleCSS Selector: [data-focus-visible]
Whether an element within the date picker is keyboard focused.
isDisabledCSS Selector: [data-disabled]
Whether the date picker is disabled.
isReadOnlyCSS Selector: [data-readonly]
Whether the date picker is read only.
isInvalidCSS Selector: [data-invalid]
Whether the date picker is invalid.
isOpenCSS Selector: [data-open]
Whether the date picker's popover is currently open.