components icon indicating copy to clipboard operation
components copied to clipboard

Datepicker doesn't use locale if user write date in input

Open rbleuse opened this issue 8 years ago • 3 comments

Bug, feature request, or proposal:

The datepicker component doesn't use locale if the user writes the date directly in the input, without choosing date from calendar popup

What is the expected behavior?

The date should be parsed with the locale set up in module

What is the current behavior?

The date uses the default locale

What are the steps to reproduce?

Here is a stackblitz with french locale : https://stackblitz.com/edit/angular-material2-issue-rb6xvc?file=app/app.component.ts

Select a date from the calendar in the first datepicker Validate first date picker Then copy paste the date in the second Validate the second date picker

If you choose 01/02/2018 (1st of february), you get these result : first : Thu Feb 01 2018 00:00:00 GMT+0100 (Paris, Madrid) second : Tue Jan 02 2018 00:00:00 GMT+0100 (Paris, Madrid)

datepicker_bug

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

ng 5.1 / material2 5.0.0

Is there anything else we should know?

rbleuse avatar Dec 11 '17 13:12 rbleuse

See #7823

Also a stackblitz example with the french locale : https://stackblitz.com/edit/angular-date-picker-sample-fr?file=app%2Fmoment-date-adapter.ts

Edit: adding stackblitz example

NaifousBS avatar Dec 11 '17 13:12 NaifousBS

Yes it works great. Thank you !

rbleuse avatar Dec 11 '17 18:12 rbleuse

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.