Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing selected class on multi-select Year Picker #5322

Open
michaelsawyers opened this issue Jan 15, 2025 · 0 comments
Open

Missing selected class on multi-select Year Picker #5322

michaelsawyers opened this issue Jan 15, 2025 · 0 comments

Comments

@michaelsawyers
Copy link

michaelsawyers commented Jan 15, 2025

Describe the bug
When using selectsMultiple along with showYearPicker, when I select various years they are not getting the selected class and therefore not able to style as selected.

To Reproduce

const MultiYearPicker = () => {
  const [selectedDates, setSelectedDates] = useState([]);

  return (
    <DatePicker
      placeholder="Select years"
      dateFormat="yyyy"
      showYearPicker
      selectsMultiple
      selectedDates={selectedDates}
      onChange={setSelectedDates}
      shouldCloseOnSelect={false}
      disabledKeyboardNavigation
    />
  );
};
  1. When I select years, say 2019 and 2024
  2. These years are added to state and I see the dates in the input
  3. But those year divs do not get the react-datepicker__year-text--selected classes so they remain unstyled.
    (This may be issue with other show_Picker variations, but showYearPicker is what I've tested.

Expected behavior
I expect the selected class being applied.

Screenshots

Screen.Recording.2025-01-15.at.10.16.00.AM.mov

Desktop (please complete the following information):

  • OS: macOS
  • Browser: chrome
  • Version 131
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant