1

I've got a internationalization difference with angular datepicker between onChange and onInput events:

Here my code:

In my module, i provide the fr format to datepicker like this:

providers: [
    {
      provide: MAT_DATE_LOCALE, useValue: 'fr-FR'
    }
],

So the return date format expected is: dd/mm/yyyy as french format. This work well when i've pick a date with the calendar. But if I enter directly by date in the input i still have a us format mm/dd/yyyy in return.

Maybe i missing something but i don't see where in the angular material documentation this case is precise.

Any help will be appreciated. Thx

Edit: I provide a stackbliz link to show my problem.

Antoine Clavijo
  • 1,277
  • 2
  • 11
  • 19
  • Are you manually entering `mm/dd/yyyy` and expecting it to change to `dd/mm/yyyy`? – vinays84 Oct 30 '17 at 14:06
  • I enter a date in `dd/mm/yyyy`, all my flow use this pattern. But when a user enter a date directly, datepicker convert it to `mm/dd/yyyy`, but by selecting the date with the calendar, it keep the good fomat – Antoine Clavijo Oct 30 '17 at 14:10
  • See [this solution](https://stackoverflow.com/questions/32566416/change-format-of-md-datepicker-in-angular-material#answer-34654424) – vinays84 Oct 30 '17 at 14:38
  • Here's it [implemented](https://codepen.io/vinays84/pen/bYNLvv) – vinays84 Oct 30 '17 at 14:47

0 Answers0