From bee7bd56fd905721e2fea6d057c5ee72945277aa Mon Sep 17 00:00:00 2001 From: melloware Date: Sat, 27 May 2023 08:12:01 -0400 Subject: [PATCH] Fix #4456: Calendar showMinMaxRange NPE --- components/lib/calendar/Calendar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/lib/calendar/Calendar.js b/components/lib/calendar/Calendar.js index 141e3f91bd..0a38d7dcc3 100644 --- a/components/lib/calendar/Calendar.js +++ b/components/lib/calendar/Calendar.js @@ -950,7 +950,7 @@ export const Calendar = React.memo( }; const setNavigationState = (newViewDate) => { - if (!props.showMinMaxRange || props.view !== 'date' || !overlayRef.current) { + if (!newViewDate || !props.showMinMaxRange || props.view !== 'date' || !overlayRef.current) { return; } @@ -972,7 +972,7 @@ export const Calendar = React.memo( firstDayOfMonth.setMonth(11, 1); firstDayOfMonth.setFullYear(firstDayOfMonth.getFullYear() - 1); } else { - firstDayOfMonth.setMonth(firstDayOfMonth.getMonth() - 1, 1); + firstDayOfMonth.setMonth(firstDayOfMonth.getMonth(), 1); } firstDayOfMonth.setHours(0);