Skip to content

Commit

Permalink
fix issue primefaces#14233:
Browse files Browse the repository at this point in the history
change isYearSelected function so it doesn't break when no date(s) is selected yet
  • Loading branch information
tindezeeuw committed Aug 28, 2024
1 parent 1f6c5d9 commit 59d9d09
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1836,13 +1836,11 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
}

isYearSelected(year: number) {
if (this.isComparable()) {
let value = this.isRangeSelection() ? this.value[0] : this.value;
if (!this.isComparable()) return false;
if (this.isMultipleSelection()) return false;

return !this.isMultipleSelection() ? value.getFullYear() === year : false;
}

return false;
let value = this.isRangeSelection() ? this.value[0] : this.value;
return value ? value.getFullYear() === year : false;
}

isDateEquals(value: any, dateMeta: any) {
Expand Down

0 comments on commit 59d9d09

Please sign in to comment.