import { Component, ChangeDetectionStrategy, Input, Output, EventEmitter } from '@angular/core';
export interface BsCustomDates {
label: string;
value: Date | Date[];
}
@Component({
selector: 'p-custom-date-view',
template: `
`,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class BsCustomDatesViewComponent {
@Input() ranges: BsCustomDates[];
@Input() selectedRange: Date[];
@Output() onSelect = new EventEmitter();
customRange: any = null;
selectFromRanges(range: BsCustomDates) {
this.onSelect.emit(range);
}
checkRange() {
return this.ranges ? this.ranges.filter(range => range.value === this.selectedRange).length > 0 : false;
}
}