I have a date range calendar using react-day-picker. It works beautifully aside from me not being able to disable "all" future days from the selection. The api docs show that you can enter a single day or multiple days but not all future days?
<DayPicker
disabledDays={new Date()} // how to disable all days after today?
modifiers={{
sunday: day => day.getDay() === 0,
firstOfMonth: day => day.getDate() === 1
}}
onDayClick={this.handleDayClick}
onDayMouseEnter={this.handleDayMouseEnter}
/>
A slightly better version is
const today = new Date();
<DayPicker
disabledDays={{ after: today }}
selectedDays={new Date()}
/>
Example: https://codesandbox.io/s/l942z0w9y9
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With