Skip to content

Commit

Permalink
fix(calendar range cells): handle unset date or selectedValue (#2537)
Browse files Browse the repository at this point in the history
  • Loading branch information
yggg committed Oct 1, 2020
1 parent 9089690 commit 0f20b9c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ export class NbCalendarDayPickerComponent<D, T> implements OnChanges {
constructor(private monthModel: NbCalendarMonthModelService<D>) {
}

ngOnChanges({ visibleDate }: SimpleChanges) {
if (visibleDate) {
ngOnChanges({ visibleDate, boundingMonths }: SimpleChanges) {
if (visibleDate || boundingMonths) {
this.weeks = this.monthModel.createDaysGrid(this.visibleDate, this.boundingMonths);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class NbCalendarRangeDayCellComponent<D> extends NbBaseCalendarRangeCell<
}

if (this.selectedValue) {
return this.dateService.isSameDay(this.date, this.selectedValue.start);
return this.dateService.isSameDaySafe(this.date, this.selectedValue.start);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class NbCalendarRangeMonthCellComponent<D> extends NbBaseCalendarRangeCel
}

if (this.selectedValue) {
return this.dateService.isSameMonth(this.date, this.selectedValue.start);
return this.dateService.isSameMonthSafe(this.date, this.selectedValue.start);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class NbCalendarRangeYearCellComponent<D> extends NbBaseCalendarRangeCell
}

if (this.selectedValue) {
return this.dateService.isSameYear(this.date, this.selectedValue.start);
return this.dateService.isSameYearSafe(this.date, this.selectedValue.start);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ export abstract class NbBasePicker<D, T, P> extends NbDatepicker<T> {
this.subscribeOnValueChange();
this.writeQueue();
this.patchWithInputs();
this.pickerRef.changeDetectorRef.markForCheck();
}

protected createPositionStrategy(): NbAdjustableConnectedPositionStrategy {
Expand Down

0 comments on commit 0f20b9c

Please sign in to comment.