-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
docsThis issue is related to documentationThis issue is related to documentationneeds triageThis issue needs to be triaged by the teamThis issue needs to be triaged by the team
Description
Documentation Feedback
Issue:
Description under Date validation describing below code snippet is wrong.
<mat-form-field class="example-full-width">
<mat-label>Choose a date</mat-label>
<input matInput [matDatepickerFilter]="myFilter" [matDatepicker]="picker">
<mat-hint>MM/DD/YYYY</mat-hint>
<mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
where,
myFilter = (d: Date | null): boolean => {
const day = (d || new Date()).getDay();
// Prevent Saturday and Sunday from being selected.
return day !== 0 && day !== 6;
};
Above snippet is an example which will prevent user from selecting saturday and sunday. However the description for it below says,
In this example the user can back past 2005, but all of the dates before then will be unselectable. They will not be able to go further back in the calendar than 2000. If they manually type in a date that is before the min, after the max, or filtered out, the input will have validation errors.
Please refer the Screenshot below,

Affected documentation page
https://material.angular.io/components/datepicker/overview#date-validation
Metadata
Metadata
Assignees
Labels
docsThis issue is related to documentationThis issue is related to documentationneeds triageThis issue needs to be triaged by the teamThis issue needs to be triaged by the team