I am using the angular material date picker . When I get the date I get the value as
Wed Sep 12 2018 00:00:00 GMT+0530 (India Standard Time)
but I need it to be in 'YYYY-MM-DD'
Here is my code so far
<mat-form-field>
<input matInput [matDatepicker]="picker" placeholder="Select a date" [(ngModel)] = 'dateSel' data-date-format='YYYY-MM-DD' >
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
I tried to use the moment.js application too. But I ended up with complicated date object.