From 60097a5093b2b85296b1090bf99bafa93a69e79c Mon Sep 17 00:00:00 2001 From: Sono Dennis Willbrand <44726085+sdwillbrand@users.noreply.github.com> Date: Thu, 1 Feb 2024 16:31:08 +0100 Subject: [PATCH] Fix primefaces#5863: Calendar enabledDates fixed (#5871) * Fix primefaces#5863: Calendar enabledDates fixed * Fix #5863: format * Update Calendar.js --------- Co-authored-by: Melloware --- components/lib/calendar/Calendar.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/lib/calendar/Calendar.js b/components/lib/calendar/Calendar.js index d2ef974fc5..fe13079bbd 100644 --- a/components/lib/calendar/Calendar.js +++ b/components/lib/calendar/Calendar.js @@ -2309,7 +2309,12 @@ export const Calendar = React.memo( if (props.enabledDates) { const isEnabled = props.enabledDates.some((d) => d.getFullYear() === year && d.getMonth() === month && d.getDate() === day); - isDisabled = isDisabled ? !isEnabled : isEnabled; + if (isEnabled) { + isDisabled = false; + } else if (!props.disabledDays && !props.disabledDates) { + // disable other dates when only enabledDates are present + isDisabled = true; + } } return isDisabled;