Skip to content

Commit bcdb253

Browse files
committed
refactor(calendar): don't block selection for disabled date through model/API
1 parent bdf35c1 commit bcdb253

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

projects/igniteui-angular/src/lib/calendar/calendar-base.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ export class IgxCalendarBaseDirective implements ControlValueAccessor {
707707

708708
switch (this.selection) {
709709
case CalendarSelection.SINGLE:
710-
if (isDate(value) && !this.isDateDisabled(value as Date)) {
710+
if (isDate(value)) {
711711
this.selectSingle(value as Date);
712712
}
713713
break;
@@ -807,9 +807,7 @@ export class IgxCalendarBaseDirective implements ControlValueAccessor {
807807
: [value, this.lastSelectedDate];
808808

809809
const unselectedDates = [this._startDate, ...this.generateDateRange(this._startDate, this._endDate)]
810-
.filter(date => !this.isDateDisabled(date)
811-
&& this.selectedDates.every((d: Date) => d.getTime() !== date.getTime())
812-
);
810+
.filter(date => this.selectedDates.every((d: Date) => d.getTime() !== date.getTime()));
813811

814812
// select all dates from last selected to shift clicked date
815813
if (this.selectedDates.some((date: Date) => date.getTime() === this.lastSelectedDate.getTime())

projects/igniteui-angular/src/lib/calendar/calendar.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,8 @@ describe("IgxCalendar - ", () => {
17671767
});
17681768

17691769
it("Should not select date from model, if it is part of disabled dates", () => {
1770-
expect(calendar.value).toBeFalsy();
1770+
// Changed per WC alignment task #16131 - calendar should not block selection of dates through API/model
1771+
expect(calendar.value).toBeTruthy();
17711772
});
17721773

17731774
it("Should not select date from model in range selection, if model passes null", () => {

0 commit comments

Comments
 (0)