I want to disable Monday from "mat-datepicker". So here is my code in the class component.
dateFilter = (_date: any) =>{
let day = _date.getDay();
console.log(day);
return day != 1;
}
And in my template file :
<input [matDatepicker]="picker" [matDatepickerFilter]="dateFilter" />
<mat-datepicker (closed)="ClosePicker($event)" #picker></mat-datepicker>
But now after implementing this, I can't see any date on my calendar. And in the months section, I just see "February" available there. No other months are showing. Does anyone know how to fix this? I am willing to share more code if needed.
Please Use Min max function to select and disable certain date periord
By using Angular Material
<mat-form-field style="width:130px;" appearance="fill">
<input style="position: relative;top: -7px;" [min]="nestedMinDate" matInput [matDatepicker]="picker3"
[(ngModel)]="nestedReorder.PromiseDate"
(change)="dateFormating(nestedReorder.PromiseDate,i,j)">
<mat-datepicker-toggle matSuffix [for]="picker3"></mat-datepicker-toggle>
<mat-datepicker #picker3></mat-datepicker>
</mat-form-field>
Type Script Code
this.minDate= formatDate(new Date(), 'yyyy-MM-dd', 'en');