the following function receives an event from the Angular Material Design DatePicker and shall print it to the console:
applyFilter(event: MatDatepickerInputEvent<Date>) {
console.log(`${event.value}`); // prints the selected date
console.log(event.value); // prints some weird object
}
But they are each printing a different output to the console. The first prints the actual selected date, the second one prints some weird object to the console.
This is my DatePicker:
<mat-form-field>
<mat-label>Anfangsdatum</mat-label>
<input matInput (dateInput) = "applyFilter($event)" [matDatepicker] = "startDatePicker">
<mat-datepicker-toggle matSuffix [for]="startDatePicker"></mat-datepicker-toggle>
<mat-datepicker #startDatePicker></mat-datepicker>
</mat-form-field>
I just want to get the date the user picked using the DatePicker from Angular Material Design, but it seems like that this overly complicated. Can someone please help me?