Is there a way to disable weekends on a calendar using date range? I've tried but can't seem to get it to work. Any suggestions?
The Issue
Can't bind to 'matDatepickerFilter' since it isn't a known property of
'input'.
#ts code
weekendsDatesFilter = (d: Date): boolean => {
const day = d.getDay();
/* Prevent Saturday and Sunday for select. */
return day !== 0 && day !== 6 ;
}
#html code
<mat-form-field appearance="fill" >
<mat-label>
SELECT DATES
</mat-label>
<mat-date-range-input [min]="currentDate" [rangePicker]="picker">
<input [matDatepickerFilter]="weekendsDatesFilter" matStartDate [(ngModel)]="model.proposedDateStart" placeholder="Start Date" required >
<input [matDatepickerFilter]="weekendsDatesFilter" matEndDate [(ngModel)]="dateEnd" placeholder="End Date" required>
</mat-date-range-input>
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-date-range-picker #picker></mat-date-range-picker>
</mat-form-field>