Skip to content

Commit

Permalink
Merge pull request #13920 from alexandergu/issue-13919
Browse files Browse the repository at this point in the history
fix(calendar): added checking for each month when checking the disabled year
  • Loading branch information
cetincakiroglu authored Mar 20, 2024
2 parents f95b4ce + 503d274 commit 6c1f8b0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1769,17 +1769,21 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
return false;
}

isMonthDisabled(month: number) {
for (let day = 1; day < this.getDaysCountInMonth(month, this.currentYear) + 1; day++) {
if (this.isSelectable(day, month, this.currentYear, false)) {
isMonthDisabled(month: number, year?: number) {
const yearToCheck = year ?? this.currentYear;

for (let day = 1; day < this.getDaysCountInMonth(month, yearToCheck) + 1; day++) {
if (this.isSelectable(day, month, yearToCheck, false)) {
return false;
}
}
return true;
}

isYearDisabled(year) {
return !this.isSelectable(1, this.currentMonth, year, false);
isYearDisabled(year: number) {
return Array(12)
.fill(0)
.every((v, month) => this.isMonthDisabled(month, year));
}

isYearSelected(year: number) {
Expand Down

0 comments on commit 6c1f8b0

Please sign in to comment.