typeScript - how to set current browser locale to angular material (md-datepicker)

203 Views Asked by At

My html code looks like this

        <md-input-container>
            <input mdInput [mdDatepicker]="startdatepicker" [(ngModel)]="startDate" placeholder="Choose a Start date">
            <button mdSuffix [mdDatepickerToggle]="startdatepicker"></button>
        </md-input-container>      
        <md-datepicker #startdatepickermd-datepicker>

and i have typeScript component file which has the startDate defined and bound to date picker.

The problem i have is when the browser locale is set to say 'en-IN' the input box has the date formatted correctly but when the datepicker is clicked and pop up the calendar reads it as MM-dd-YYYY and shows the wrong date.

0

There are 0 best solutions below