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

2 Dates selected when selecting a day and changing months

Open Jonohas opened this issue 2 years ago • 3 comments

Describe the bug When you select a date that is available in the next or previous month you will get 2 selected dates when changing months.

To Reproduce

  1. Go to September 2022
  2. Select third of September
  3. Navigate to the august month
  4. See that 2 dates are highlighted

Expected behavior The highlighted date should only be that specific day

Screenshots image

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Brave
  • Version 1.42.97

Additional context It only seems to be a visual bug.

Jonohas avatar Aug 30 '22 08:08 Jonohas

I'm also facing the same. Can anyone help??

tarang-parmar avatar Sep 02 '22 10:09 tarang-parmar

add this CSS to your project, it worked for me

.react-datepicker__day--keyboard-selected { background-color: inherit !important; color: #000 !important; }

tarang-parmar avatar Sep 02 '22 10:09 tarang-parmar

.react-datepicker__day--keyboard-selected { background-color: inherit !important; color: #000 !important; }

This CSS works but it also removes the highlight from every month.

Muhiq146 avatar Sep 02 '22 11:09 Muhiq146

Yeah, it's just a CSS issue where the color of keyboard-selected was too close to normal selected. I made a CSS change that makes it lighter for keyboard selected, so this issue could be closed.

luddensdesir avatar Oct 08 '22 03:10 luddensdesir

In the previous solution, the highlight doesn't work on today's date.

A new solution to fix this issue also.

.react-datepicker__day--keyboard-selected {
  background-color: inherit !important;
  color: #000 !important;
}

.react-datepicker__day--keyboard-selected.react-datepicker__day--today {
  background-color: #216ba5 !important;
  color: #fff !important
}

Muhiq146 avatar Nov 30 '22 13:11 Muhiq146