Max value in Mat ragepicker is not reflecting dynamically.
I have replicated the same below.
https://stackblitz.com/edit/angular-uc41kx-7a8m4h?file=src/app/date-range-picker-overview-example.html
The below is what I have tried
I wanted to limit the date selection to only 29 days.
So when the date is changed the max value will be updated by
startChange($event)
function using (dateChange)
event.
startChange(event: MatDatepickerInputEvent<Date>) {
let maxDate;
this.minDate = event.value;
maxDate = moment(this.minDate).add(29, 'days').toDate();
if (this.currentDate < maxDate) {
this.currentDate = moment().toDate() ;
} else {
this.currentDate = moment(this.minDate).add(29, 'days').toDate();
}
}
But with the above is not working,
Can anyone help me here.