Skip to content

Commit

Permalink
Fix primefaces#4892: Calendar highlight selected months and years in …
Browse files Browse the repository at this point in the history
…multiple mode
  • Loading branch information
melloware committed Sep 9, 2023
1 parent 137d0c7 commit 206d260
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,11 @@ export const Calendar = React.memo(
if (isComparable()) {
let value = isRangeSelection() ? props.value[0] : props.value;

return !isMultipleSelection() ? value.getMonth() === month && value.getFullYear() === currentYear : false;
if (isMultipleSelection()) {
return value.some((currentValue) => currentValue.getMonth() === month && currentValue.getFullYear() === currentYear);
} else {
return value.getMonth() === month && value.getFullYear() === currentYear;
}
}

return false;
Expand All @@ -1934,7 +1938,11 @@ export const Calendar = React.memo(
if (isComparable()) {
let value = isRangeSelection() ? props.value[0] : props.value;

return !isMultipleSelection() && isComparable() ? value.getFullYear() === year : false;
if (isMultipleSelection()) {
return value.some((currentValue) => currentValue.getFullYear() === year);
} else {
return value.getFullYear() === year;
}
}

return false;
Expand Down

0 comments on commit 206d260

Please sign in to comment.