Not getting default classname on using modifiers for week and month range selection #2887
Answered
by
gpbl
nikhil2802Vishwakarma
asked this question in
Support
-
Beta Was this translation helpful? Give feedback.
Answered by
gpbl
Jan 19, 2026
Replies: 1 comment 1 reply
-
|
@nikhil2802Vishwakarma I believe the Convert your Dayjs range to For example: const range = selectedDate
? { from: selectedDate.from?.toDate(), to: selectedDate.to?.toDate() }
: undefined;
<DayPicker
showOutsideDays
modifiers={{
selected: range,
range_start: range?.from,
range_end: range?.to,
range_middle: (date) =>
range ? rangeIncludesDate(range, date, true) : false,
}}
// ...
/>If you want to keep Dayjs, use function matchers: modifiers={{
range_start: (date) => range?.from && dayjs(date).isSame(range.from, "day"),
range_end: (date) => range?.to && dayjs(date).isSame(range.to, "day"),
range_middle: (date) =>
range?.from &&
range?.to &&
dayjs(date).isAfter(range.from, "day") &&
dayjs(date).isBefore(range.to, "day"),
}}Also, since you’re doing custom selection, remember to mirror |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
nikhil2802Vishwakarma
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

@nikhil2802Vishwakarma I believe the
range_*modifiers aren’t matching because DayPicker expects nativeDatevalues.Convert your Dayjs range to
Datebefore passing it, or use function matchers that compare via Dayjs.For example:
If you want to keep Dayjs, use function matchers: