Skip to content

Commit

Permalink
Fix primefaces#4456: Calendar showMinMaxRange NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed May 27, 2023
1 parent 281b300 commit 0f1e798
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
Expand All @@ -986,7 +986,6 @@ export const Calendar = React.memo(
}
}

// next (check last day of month at 11:59:59)
if (props.maxDate) {
let lastDayOfMonth = cloneDate(newViewDate);

Expand Down

0 comments on commit 0f1e798

Please sign in to comment.