react-day-picker icon indicating copy to clipboard operation
react-day-picker copied to clipboard

You can select disabled dates if you write them in the input.

Open MrPaolinsky opened this issue 4 years ago • 2 comments

Bug description

You can select disabled dates if you write them in the input.

To reproduce

<DayPickerInput 
  dayPickerProps={{
    modifiers: {
      disabled: [{after: new Date()}]
    }
  }}
/>

Steps

  1. Write a future date, for example tomorrow (2021-12-29)

Expected behavior

I am not sure how it is suposed to behave the input if you select a disabled date.

Screenshots

Screen Shot 2021-12-28 at 11 52 36 AM

MrPaolinsky avatar Dec 28 '21 16:12 MrPaolinsky

For now I did this workaround:

onDayChange={(day: Date) => {=
    const today = new Date().getDate();
    if (day && day.getDate() > today) {
      day.setDate(today);
    }

    setDate(day);
}}

MrPaolinsky avatar Dec 28 '21 16:12 MrPaolinsky

Closing as we've released v8: this issue belongs to a version which is not longer maintained, and it is likely fixed. In case, please open a new issue. Thanks!

gpbl avatar Mar 26 '22 23:03 gpbl