Please replace your html file with below
your.component.html
<mat-form-field>
<mat-label>Choose Start date</mat-label>
<input matInput [max]="unavailabilityForm.controls.startDate.value" [matDatepicker]="picker1" />
<mat-datepicker-toggle matSuffix [for]="picker1"></mat-datepicker-toggle>
<mat-datepicker [dateClass]="dateClass" #picker1></mat-datepicker>
</mat-form-field>
<mat-form-field class="example-full-width" appearance="fill">
<mat-label>Choose End date</mat-label>
<input matInput [min]="unavailabilityForm.controls.endDate.value" [matDatepicker]="picker" />
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker [dateClass]="dateClass" #picker></mat-datepicker>
</mat-form-field>
your.component.ts
import { Component, OnInit, ViewEncapsulation } from "@angular/core";
import { FormBuilder } from "@angular/forms";
/** @title Datepicker with custom date classes */
@Component({
selector: "datepicker-date-class-example",
templateUrl: "datepicker-date-class-example.html",
styleUrls: ["datepicker-date-class-example.css"],
encapsulation: ViewEncapsulation.None
})
export class DatepickerDateClassExample implements OnInit {
unavailabilityForm: any;
maxDate = new Date();
constructor(private formBuilder: FormBuilder) {}
ngOnInit() {
let startDateTimeStamp = new Date().setFullYear(new Date().getFullYear() - 10);
this.unavailabilityForm = this.formBuilder.group({
startDate: [new Date(startDateTimeStamp)],
endDate: [new Date()]
});
}
}
It will resolve your concern.