I have successfully implemented the nebular date range picker to filter data. However, I am facing an issue with setting the default maxDate 3 days after selecting the input. I have tried multiple methods but none have worked for me. Below is my TypeScript code:
import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import { NbDateService } from '@nebular/theme';
@Component({
selector: 'nb-datepicker-showcase',
template: `
<nb-card size="large">
<nb-card-body>
<input nbInput placeholder="Pick Date" [nbDatepicker]="formpicker">
<nb-rangepicker #formpicker></nb-rangepicker>
</nb-card-body>
</nb-card>
`,
styleUrls: ['./datepicker-example.scss'],
})
export class DatepickerShowcaseComponent {
min: Date;
max: Date;
constructor(protected dateService: NbDateService<Date>) {
this.min = this.dateService.addDay(this.dateService.today(), -2);
this.max = this.dateService.addDay(this.dateService.today(), 2);
}
}
Additionally, I attempted to use the min/max date properties but was unsuccessful. Here is the code snippet:
<input nbInput placeholder="Pick Date" [nbDatepicker]="picker">
<nb-rangepicker #picker [min]="min" [max]="max"></nb-rangepicker>