'MatDatepickerInputEvent requires 1 type argument
I have a date picker on the picker I add the dateChange event for catch the event in ts
html date picker field
<mat-form-field class="date-picker-field picker" floatLabel="always" appearance="fill">
<mat-label>Період від</mat-label>
<input [max]="maxDay" (dateChange)="fromDateChangeEvent($event)" matInput [matDatepicker]="dp3">
<mat-datepicker-toggle matSuffix [for]="dp3">
<mat-icon matDatepickerToggleIcon>
<img src="../../../../../../../assets/img/system/ic-system-calendar.svg" alt="">
</mat-icon>
</mat-datepicker-toggle>
<mat-datepicker #dp3 disabled="false"></mat-datepicker>
</mat-form-field>
typescript file
Here I'm catching the event
fromDateChangeEvent(beforeDate: MatDatepickerInputEvent): void {
this.minDay = new Date(beforeDate.target.value);
}
but on the time of compiling time I'm getting this error in the console
Generic type 'MatDatepickerInputEvent<D>' requires 1 type argument(s).
I tried to add string or number as a type,like this
fromDateChangeEvent(beforeDate: MatDatepickerInputEvent<string | number>): void {
this.minDay = new Date(beforeDate.target.value);
}
But I got the same error, I'd not like to add any type
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
