0
I am using the Datepicker of Angular Material and need to block Saturdays and Sundays in order not to be selected. How can I do this ?
Code:
ts
import {Component} from '@angular/core';
/** @title Basic datepicker */
@Component({
selector: 'datepicker-overview-example',
templateUrl: 'datepicker-overview-example.html',
styleUrls: ['datepicker-overview-example.css'],
})
export class DatepickerOverviewExample {}
html
<mat-form-field>
<input matInput [matDatepicker]="picker" placeholder="Choose a date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
Imagery:
An option for handling this component is https://momentjs.com/ check the documentation, there are other options also that may be very useful in the future.
– Getulio Rafael Ferreira