0

I found the code below in this page:

<DayPicker
  initialMonth={new Date(2017, 3)}
  disabledDays={[
    new Date(2017, 3, 12),
    new Date(2017, 3, 2),
    {
      after: new Date(2017, 3, 20),
      before: new Date(2017, 3, 25),
    },
  ]}
/>

I am trying to apply it ( re disabledDays ) to my case (i.e. when using 'DayPickerInput', not 'DayPicker') as follows:

<DayPickerInput
  // ...
  disabledDays: {
    before: pydate.toDate(),
    after: date,
  },
/>

But it does not work. What am I doing wrong ?

Tholle
  • 108,070
  • 19
  • 198
  • 189
Ula
  • 2,628
  • 2
  • 24
  • 33

1 Answers1

0

After some research I found that it should be as follows:

<DayPickerInput
  // ...
  dayPickerProps={{
    enableOutsideDays: false,
    disabledDays: {
      before: pydate.toDate(), // pydate is generated using moment.js
      after: date,  // date is generated using new Date(...)
    },
  }}
/>

Hope it helps someone.

Tholle
  • 108,070
  • 19
  • 198
  • 189
Ula
  • 2,628
  • 2
  • 24
  • 33