I am trying to format below date to following format MM-DD-YYYY in Angular 6. I had a look at simpler issues posted in SO and other sites as well but I am unable to resolve it.
I am using Material Angular DatePicker component.
Date picker gives me
Thu Oct 25 2018 00:00:00 GMT+0400 (Gulf Standard Time)
I want to format it to
MM-DD-YYYY
My code
<mat-form-field>
<input matInput [min]="minDate" [matDatepicker]="date" [(ngModel)]="request.date | request.date: 'dd/MM/yyyy hh:mm a'" placeholder="Choose a date">
<mat-datepicker-toggle matSuffix [for]="date"></mat-datepicker-toggle>
<mat-datepicker #date></mat-datepicker>
</mat-form-field>
I also tried with DatePipe module like below but nothing works
this.datePipe.transform(this.request.date,"MM-DD-YYYY")