Components: Setting the locale does not change the displayed date.

Created on 8 Mar 2019  路  7Comments  路  Source: angular/components

What is the expected behavior?

That the displayed date changes when the locale is updated.

What is the current behavior?

Changing the locale does not affect the displayed value of the DatePicker component.

What are the steps to reproduce?

https://stackblitz.com/angular/bayaoxeekbm?file=app%2Fdatepicker-locale-example.ts

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

Latest versions

Most helpful comment

All 7 comments

I have the same issue, seems the datepicker display format is stuck on UTC but the output has the correct timezone.

It seems to work for me when I move the example into our local dev app. The issue might be due to the Moment locale data not being included for the locale you're switching to.

@crisbeto I'm not using Moment locales in our app and we're setting LOCALE_ID in the AppModule, which it should be picking up.

Interestingly enough, the issue happens only when the logic is implemented in the AppModule. When this this logic is implemented in a different module (i.e. SharedModule or even in a service) it does work 馃槙

This looks like a dup of https://github.com/angular/components/issues/9780 which seems to only affect stackblitz examples

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

3mp3ri0r picture 3mp3ri0r  路  3Comments

alanpurple picture alanpurple  路  3Comments

MurhafSousli picture MurhafSousli  路  3Comments

theunreal picture theunreal  路  3Comments

vanor89 picture vanor89  路  3Comments