From 3903608196d0396ae5768bac59ab35db30275432 Mon Sep 17 00:00:00 2001 From: Kiril Volskiy Date: Fri, 7 Jun 2024 21:03:46 +0300 Subject: [PATCH 1/2] fix: use new Date instead of cloned date --- components/lib/calendar/Calendar.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/lib/calendar/Calendar.js b/components/lib/calendar/Calendar.js index 56fbc83638..16d45ab80a 100644 --- a/components/lib/calendar/Calendar.js +++ b/components/lib/calendar/Calendar.js @@ -477,8 +477,7 @@ export const Calendar = React.memo( }; const onMonthDropdownChange = (event, value) => { - const currentViewDate = getViewDate(); - let newViewDate = cloneDate(currentViewDate); + let newViewDate = new Date(); newViewDate.setMonth(parseInt(value, 10)); From 4d4c8502bd00811be16c2cb342751f546a53668e Mon Sep 17 00:00:00 2001 From: Kiril Volskiy Date: Fri, 7 Jun 2024 21:28:10 +0300 Subject: [PATCH 2/2] fix: reset the day of the cloned date --- components/lib/calendar/Calendar.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/lib/calendar/Calendar.js b/components/lib/calendar/Calendar.js index 16d45ab80a..27d78d2226 100644 --- a/components/lib/calendar/Calendar.js +++ b/components/lib/calendar/Calendar.js @@ -477,8 +477,10 @@ export const Calendar = React.memo( }; const onMonthDropdownChange = (event, value) => { - let newViewDate = new Date(); + const currentViewDate = getViewDate(); + let newViewDate = cloneDate(currentViewDate); + newViewDate.setDate(1); newViewDate.setMonth(parseInt(value, 10)); updateViewDate(event, newViewDate);