0

So im trying to disable days in react-day-picker with before after and array parameters.

This will only disable before and after

    disabledDays={[
      {after:moment().add(1, 'months').toDate()},
      {before:moment().toDate()},
      {bannedDates}
      ]}

This will disable the array days so i know bannedDates work

        disabledDays={
      bannedDates
      }

dates are in format

0: Mon Mar 04 2019 16:33:09 GMT+0100 (centraleuropeisk normaltid) {}

How can i get all three parameters to work at the same time?

TOBE
  • 112
  • 1
  • 5

1 Answers1

0

Just push {before: ..., after: ...} to bannedDates.

This way:

let bannedDates = [...];
bannedDates.push({
    after:moment().add(1, 'months').toDate(),
    before:moment().toDate()
});

Then disabledDays = bannedDates

Here is an example