From 59c2054e92eacc67daf9faabc91ad8f5157525f3 Mon Sep 17 00:00:00 2001 From: balajis-qb Date: Sat, 10 May 2025 16:40:21 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20EndDatePicker=20selection?= =?UTF-8?q?=20range=20progress?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Undo the PR https://github.com/Hacker0x01/react-datepicker/pull/5503 as by default we preselect the selected date to other months also, as a result the linked PR will disturb the keyboard selection range --- src/day.tsx | 1 - src/test/datepicker_test.test.tsx | 29 ----------------------------- 2 files changed, 30 deletions(-) diff --git a/src/day.tsx b/src/day.tsx index 49c59ff613..1c28426a5e 100644 --- a/src/day.tsx +++ b/src/day.tsx @@ -312,7 +312,6 @@ export default class Day extends Component { if ( selectsEnd && startDate && - !endDate && (isAfter(selectingDate, startDate) || isEqual(selectingDate, startDate)) ) { return isDayInRange(day, startDate, selectingDate); diff --git a/src/test/datepicker_test.test.tsx b/src/test/datepicker_test.test.tsx index b4c64021d5..54d9d900a0 100644 --- a/src/test/datepicker_test.test.tsx +++ b/src/test/datepicker_test.test.tsx @@ -3153,35 +3153,6 @@ describe("DatePicker", () => { ).toBe(true); } }); - - it("should not apply '--in-selecting-range' class to the days till the date that matched selectedDate in the next months (endDatePicker)", () => { - const startDay = 3; - const endDay = 8; - const startDate = new Date(`2025/02/${startDay}`); - const endDate = new Date(`2025/02/${endDay}`); - - const { container } = render( - , - ); - - goToNextMonth(container); - - for (let i = 1; i <= endDay; i++) { - const inSelectionRangeDay = safeQuerySelector( - container, - `.react-datepicker__day--00${i}`, - ); - expect( - inSelectionRangeDay.classList.contains(IN_RANGE_DAY_CLASS_NAME), - ).toBe(false); - } - }); }); describe("selectsRange without inline", () => {