Constraints
Min & Max Days
Restrict the range length with minDays and maxDays (inclusive). Users cannot confirm a range shorter than minDays or longer than maxDays.
import { useState } from "react";import "react-date-range-picker-styled/rdrp-styles.css";import { DateRangePicker } from "react-date-range-picker-styled";
function MinMaxDays() { const [value, setValue] = useState<{ start: Date | null; end: Date | null }>({ start: null, end: null, });
return <DateRangePicker value={value} onChange={setValue} minDays={3} maxDays={14} />;}Disabled Dates
Use isDateUnavailable to dynamically disable specific dates. Disabled dates cannot be selected as start or end of a range.
import { useState } from "react";import "react-date-range-picker-styled/rdrp-styles.css";import { DateRangePicker } from "react-date-range-picker-styled";
const isWeekend = (date: Date) => { const day = date.getDay(); return day === 0 || day === 6;};
function DisabledDates() { const [value, setValue] = useState<{ start: Date | null; end: Date | null }>({ start: null, end: null, });
return <DateRangePicker value={value} onChange={setValue} isDateUnavailable={isWeekend} />;}Allow Single Date
By default, a range where start equals end is allowed. Set allowSingleDateInRange={false} to require at least two distinct dates.
import { useState } from "react";import { DateRangePicker } from "react-date-range-picker-styled";import "react-date-range-picker-styled/rdrp-styles.css";
function AllowSingleDate() { const [value, setValue] = useState<{ start: Date | null; end: Date | null }>({ start: null, end: null, });
return <DateRangePicker value={value} onChange={setValue} allowSingleDateInRange={false} />;}