react-datepicker icon indicating copy to clipboard operation
react-datepicker copied to clipboard

Double selected month and year when previously selected and selected via keyboard

Open Nataly19910601 opened this issue 8 months ago • 0 comments

When the YearPicker and MonthPicker are enabled in the react-datepicker component, and a date is already selected, clicking on a month or a year adds the classes react__month-text--keyboard-selected and react-datepicker__year-text--keyboard-selected. However, the classes react-datepicker__year-text--selected and react-datepicker__month-text--selected (or __year-text--range-start, __month-text--range-start in the case of a range) are not removed from the previously selected dates.

Steps to reproduce:

Enable YearPicker and MonthPicker in the react-datepicker component.

Select a date.

Click on a month or a year.

Notice that the old classes react-datepicker__year-text--selected and react-datepicker__month-text--selected do not disappear, and the new classes react__month-text--keyboard-selected and react-datepicker__year-text--keyboard-selected are added.

Expected behavior: After clicking on a month or a year, the old classes should be removed, and the new classes should be added correctly.

Current version: react-datepicke: "8.3.0"

Nataly19910601 avatar Apr 17 '25 08:04 Nataly19910601