From 812cda42817b3ba682c921178d056e4603743f41 Mon Sep 17 00:00:00 2001 From: Batuhan Tomo Date: Mon, 22 Apr 2024 17:39:14 +0300 Subject: [PATCH 1/2] Fix #6445 --- components/lib/calendar/Calendar.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/components/lib/calendar/Calendar.js b/components/lib/calendar/Calendar.js index 520629b63f..c797e6ee01 100644 --- a/components/lib/calendar/Calendar.js +++ b/components/lib/calendar/Calendar.js @@ -1055,12 +1055,16 @@ export const Calendar = React.memo( setViewDateState(value); } + if(!value) { + onClearButtonClick(event); + } + if (value !== null) { - setCurrentMonth(value.getMonth()); - setCurrentYear(value.getFullYear()); - } else { - setCurrentMonth(null); - setCurrentYear(null); + const day = value.getDate(); + const month = value.getMonth(); + const year = value.getFullYear(); + + onDateSelect(event, { day, month, year, selectable: isSelectable(day, month, year) }); } }; From 49f1ecb2cc93128e0ba4752365eca5dad25710ab Mon Sep 17 00:00:00 2001 From: Batuhan Tomo Date: Mon, 22 Apr 2024 17:47:59 +0300 Subject: [PATCH 2/2] Fix #6445 update --- components/lib/calendar/Calendar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lib/calendar/Calendar.js b/components/lib/calendar/Calendar.js index c797e6ee01..620e5dd985 100644 --- a/components/lib/calendar/Calendar.js +++ b/components/lib/calendar/Calendar.js @@ -1055,7 +1055,7 @@ export const Calendar = React.memo( setViewDateState(value); } - if(!value) { + if (!value) { onClearButtonClick(event); }