Description
import { NgbCalendar, NgbDate } from 'node_modules/@ng-bootstrap/ng-bootstrap';
package.json:
"@ng-bootstrap/ng-bootstrap": "^3.0.0",
"bootstrap": "^4.1.3",
<ngb-datepicker #dp (select)="onDateSelection($event)" [displayMonths]="2" [dayTemplate]="t" outsideDays="hidden">
<ng-template #t let-date let-focused="focused">
<span class="custom-day"
[class.focused]="focused"
[class.range]="isRange(date)"
[class.faded]="isHovered(date) || isInside(date)"
(mouseenter)="hoveredDate = date"
(mouseleave)="hoveredDate = null">
{{ date.day }}
in the component:
isRange(date: NgbDate) {
return date.equals(this.fromDate) || date.equals(this.toDate) || this.isInside(date) || this.isHovered(date);
}
debug console:
cannot read property 'equals' of undefined - .isRange.