-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Describe the bug
See issue: #5502
and PR: #5503
This has broken the --in-selecting-range styling for endDate pickers when hovering on a date when startDate and endDate are already set.
To Reproduce
Copied from linked issue:
() => {
const [startDate, setStartDate] = useState(null);
const [endDate, setEndDate] = useState(null);
return (
<>
<DatePicker
selected={startDate}
onChange={(date) => setStartDate(date)}
selectsStart
startDate={startDate}
endDate={endDate}
/>
<DatePicker
selected={endDate}
onChange={(date) => setEndDate(date)}
selectsEnd
startDate={startDate}
endDate={endDate}
minDate={startDate}
/>
</>
);
};
- You have start date 1st march, and end date 31st march set.
- Open the start picker and hover over a date in the middle, and you get the
--in-selecting-rangestyling for the dates after the one you are hovering on (as expected) - Open the end picker and hover over a date in the middle, and you do not get the
--in-selecting-rangestyling. You should get that class on the dates before the one you are hovering on - as you did in version 8.2.1
Expected behavior
I expect the --in-selecting-range class to be added to all dates between the start date and the date I am hovering on in the end picker
This should happen if I am hovering before the end date, or after it (if the end date is earlier in the month)
Screenshots
As described above, start and end dates set to start and end of march..
- Hovering in start picker shows
--in-selecting-rangestyling
- Hovering in end picker does not show
--in-selecting-rangestyling (i'm hovering on a date in the middle here)
Desktop (please complete the following information):
- OS: MacOS 15.3.2
- Browser: Chrome
- Version: 135
Other comments
The linked issue has not been fixed correctly - I believe the issue was if you had start date set to 1st March, end date sent to 15th March then navigated to April, with no hovering it would have --in-selecting-range class on all dates up to 15th APRIL - I can see this happening on 8.2.1 and not happening on 8.3.0.
It is adding the --keyboard-selected class to the 15th April, then the 15th May etc as you move forward each month - I assume this part is desired behaviour (eg you can navigate forward a month and hit enter, you get the same day in the new month that was selected in the previous month)

