Skip to content

Commit

Permalink
Merge pull request #14781 from eduardheller89/master
Browse files Browse the repository at this point in the history
Fix #14590 and #12286 - Single dates not possible with calendar in range mode
  • Loading branch information
cetincakiroglu authored Mar 22, 2024
2 parents b72fb02 + ec3ca82 commit 57d2950
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/app/components/calendar/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2747,16 +2747,13 @@ export class Calendar implements OnInit, OnDestroy, ControlValueAccessor {
}

isValidSelection(value: any): boolean {
let isValid = true;
if (this.isSingleSelection()) {
if (!this.isSelectable(value.getDate(), value.getMonth(), value.getFullYear(), false)) {
isValid = false;
}
} else if (value.every((v: any) => this.isSelectable(v.getDate(), v.getMonth(), v.getFullYear(), false))) {
if (this.isRangeSelection()) {
isValid = value.length > 1 && value[1] > value[0] ? true : false;
}
}
return this.isSelectable(value.getDate(), value.getMonth(), value.getFullYear(), false);
}
let isValid = value.every((v: any) => this.isSelectable(v.getDate(), v.getMonth(), v.getFullYear(), false));
if (isValid && this.isRangeSelection()) {
isValid = value.length === 1 || (value.length > 1 && value[1] >= value[0]);
}
return isValid;
}

Expand Down

0 comments on commit 57d2950

Please sign in to comment.