2

I am using the NPM package react-day-picker and there seems to be minimal documentation on the react-day-picker-input element. It mentions a prop called dayPickerProps which takes an object called disabledDays. I can't figure out how to disable weekends and specific days combined. I got it to disable weekends and the days individually but when combined only the first is taken. The documentation discusses how to implement this for the regular day picker but not the day picker input component which takes different props. Does anyone familiar with this package know how I can accomplish this task?

Heres my Fiddle

Notice how removing the before key enables the daysOfWeek key to work. Any help is appreciated thanks.

Kim Desrosiers
  • 744
  • 7
  • 13
Jake
  • 712
  • 7
  • 20

2 Answers2

13

Try this instead

dayPickerProps={{
      modifiers: {
        disabled: [
          {
            daysOfWeek: [0, 6]
          },
          {
            before: new Date(2018, 7, 8)
          }
        ]
      }
    }}

https://codesandbox.io/s/537qkxy4wn

Max Caron
  • 146
  • 1
  • 6
1

If you only use DayPicker, you can just pass modifiers as props like this

<DayPicker
  modifiers={{
    disabled: [
      {
        daysOfWeek: [0, 6]
      },
      {
        before: today
      }
    ]
  }}
/>