Search code examples
reactjsreact-day-picker

how to disable an array of dates in react-day-picker?


i have an array of dates which i store in a state called "row".

enter image description here

i want to disable these days in react-day-picker

<DayPicker
          selectedDays={this.state.selectedDays}
          onDayClick={this.handleDayClick}
          disabledDays={
                        [{
                           before: new Date(),
                            },]
                       }
                    />

how can i disable these dates in daypicker?


Solution

  • As per the documentation, for your problem, you just need to pass an array of days object into disabledDays prop.

    check it: http://react-day-picker.js.org/api/DayPicker/#disabledDays

    To know how to use the object, you can refer this page: http://react-day-picker.js.org/docs/matching-days/