How to read value of angular material date picker using reactive form?

778 views Asked by At

I am using the angular v-8 and angular-material v-8. I have created a reactive form inside the form I created a material date picker and when I try to read its value its gives me an object, not an exact value.

Form field code :

<mat-form-field>
<mat-label>Date of Birth</mat-label>
<input matInput [matDatepicker]="dob" formControlName="dateOfBirth">
<mat-datepicker-toggle matSuffix [for]="dob"></mat-datepicker-toggle>
<mat-datepicker #dob></mat-datepicker>

Inside the typescript file, I try to read the value with

this.studentForm.get('dateOfBirth').value

but its not returning the date value. It works fine with input and other controls but with the picker not working.

0

There are 0 answers