0
I’m working with this component example: https://stackblitz.com/edit/angular-ytr3qa
I need to add three features.
The first I believe has to do with class, as in this example, if the day is outside the minimum or maximum permitted date, the day would be "deactivated" with a different colouring. My attempts to reproduce the above example were all failures.
It should look something like this:
The second feature would be to call the datapicker only when a button was clicked.
And the third feature has to do with business rule, when selecting the "dateFrom", I would like to change the setting, to allow you to select "dateTo" for a maximum of one month from the date selected in "dateFrom".
I tried to do the following:
onDateSelection(date: NgbDateStruct, config: NgbDatepickerConfig) {
if (!this.fromDate && !this.toDate) {
this.fromDate = date;
config.maxDate = {year: date.year, month: date.month + 1, day: date.day};
} else if (this.fromDate && !this.toDate && after(date, this.fromDate)) {
this.toDate = date;
} else {
this.toDate = null;
this.fromDate = date;
config.maxDate = {year: date.year, month: date.month + 1, day: date.day};
}
}
But the following error returns to me:
ERROR Error: Cannot set Property 'maxDate' of Undefined
This can also be seen in https://stackblitz.com/edit/angular-ytr3qa