Search code examples
javascriptreactjsreact-day-picker

How do I combine disabled days using react-day-picker-input


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.


Solution

  • Try this instead

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

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