Skip to content
Discussion options

You must be logged in to vote

@nikhil2802Vishwakarma I believe the range_* modifiers aren’t matching because DayPicker expects native Date values.

Convert your Dayjs range to Date before passing it, or use function matchers that compare via Dayjs.

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

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@nikhil2802Vishwakarma
Comment options

Answer selected by nikhil2802Vishwakarma
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants