From 3cfdab697a02ee3cfa598792c378d39e13299b6d Mon Sep 17 00:00:00 2001 From: Faisal ahmed Date: Wed, 9 Nov 2022 13:05:05 +0600 Subject: [PATCH] In primeng calendar, date can be lined through or disabled using date template. But in year view there is no option to disable dates. In my solution, if maxDate or minDate is there, then the years outside this range shoud be disabled. --- src/app/components/calendar/calendar.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/components/calendar/calendar.ts b/src/app/components/calendar/calendar.ts index 8fae497a085..5930fd125d5 100755 --- a/src/app/components/calendar/calendar.ts +++ b/src/app/components/calendar/calendar.ts @@ -197,7 +197,8 @@ export const CALENDAR_VALUE_ACCESSOR: any = {
- + {{ y }}
@@ -1650,6 +1651,10 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor { return true; } + isYearDisabled(year) { + return !this.isSelectable(1, this.currentMonth, year, false); + } + isYearSelected(year: number) { if (this.isComparable()) { let value = this.isRangeSelection() ? this.value[0] : this.value;