How do I customise mat-datepicker date in MM/DD/YYYY format?
I'm using following following configuration:
HTML:
<mat-form-field>
<input matInput [matDatepicker]="picker" placeholder="Choose a date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
TS:
import {Component} from '@angular/core';
/** @title Basic datepicker */
@Component({
selector: 'datepicker-overview-example',
templateUrl: 'datepicker-overview-example.html',
styleUrls: ['datepicker-overview-example.css'],
})
export class DatepickerOverviewExample {}
When I print the form value it gives me following output:
Sun Dec 31 2017 00:00:00 GMT+0530 (IST)
I'm expecting format in MM/DD/YYYY.
I tried this configuration: https://material.angular.io/components/datepicker/overview#customizing-the-parse-and-display-formats
But it didn't work for me. I'm using default MatNativeDateModule (Not moment js)