From 302cb38f1442fe8c679c906121d4d75d9b899d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yi=C4=9Fit=20FINDIKLI?= Date: Tue, 7 Dec 2021 10:45:28 +0300 Subject: [PATCH] Fixed #10931 Calendar | Year Picker and Month Picker empty when value empty and using Range or Multiple Selection --- src/app/components/calendar/calendar.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/app/components/calendar/calendar.ts b/src/app/components/calendar/calendar.ts index f59587fc078..c123ce8d011 100755 --- a/src/app/components/calendar/calendar.ts +++ b/src/app/components/calendar/calendar.ts @@ -1212,15 +1212,23 @@ export class Calendar implements OnInit,OnDestroy,ControlValueAccessor { } isMonthSelected(month) { - let value = this.isRangeSelection() ? this.value[0] : this.value; + if (this.isComparable()) { + let value = this.isRangeSelection() ? this.value[0] : this.value; - return !this.isMultipleSelection() && this.isComparable() ? (value.getMonth() === month && value.getFullYear() === this.currentYear) : false; + return !this.isMultipleSelection() ? (value.getMonth() === month && value.getFullYear() === this.currentYear) : false; + } + + return false; } isYearSelected(year) { - let value = this.isRangeSelection() ? this.value[0] : this.value; + if (this.isComparable()) { + let value = this.isRangeSelection() ? this.value[0] : this.value; - return !this.isMultipleSelection() && this.isComparable() ? (value.getFullYear() === year) : false; + return !this.isMultipleSelection() ? (value.getFullYear() === year) : false; + } + + return false; } isDateEquals(value, dateMeta) {