1

I have used angular date filter to format and display dates in medium format. However, how can I automatically detect what locale user have and configure angular to display the correct date format for that particular Country and language? User will not be able to change language in the application, only through configurations in browser (I guess). So its ok to refresh in order to reflect the changes.

Im also using momentjs for other date-functions, but has not used it for this purpose. Maybe I should?

The frontend application is served by nodejs and REST services are used between these two.

Ismar Slomic
  • 5,315
  • 6
  • 44
  • 63
  • possible duplicate of [Best way to determine user's locale within browser](http://stackoverflow.com/questions/673905/best-way-to-determine-users-locale-within-browser) – heptadecagram May 02 '14 at 20:53
  • That post is 5 years old, but it might be that we have not come any longer on this topic since then?! – Ismar Slomic May 02 '14 at 21:09
  • How can timezone module help me detecting what locale current user has? – Ismar Slomic May 02 '14 at 22:10
  • Oh, sorry LOL, totally read that wrong! I don't know a good answer. In the last international app I worked on we had a language selector in the app and did not even look at headers etc. I suspect header inspection will be the most effective thing right now though. – aet May 02 '14 at 22:27
  • Moment timezone won't help. Accept-Language headers are still the way to go. – Mike Quinlan May 02 '14 at 22:40

0 Answers0