question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does not pick up browser locale settings anymore

See original GitHub issue

Describe the bug Luxon 2 does not pick up the browser locale anymore.

  • Settings.defaultLocale is null
  • systemLocale had its detection functionality removed

To Reproduce Use a non-English browser and output a DateTime.toLocaleString() without setting any locales.

Actual vs Expected behavior Expected: The date is output in the browser language. (This works in Luxon ^1) Actual: The date is output in en-US.

Desktop (please complete the following information):

  • OS: Win10
  • Browser: Chrome92
  • Luxon version: 2.0.1
  • Your timezone: Europe/Berlin

Additional context the detection was removed here: https://github.com/moment/luxon/commit/6bb7488b8a2869c6f1b70ca7fac55f9e2e439485#diff-572c92ef1c461030cf7e47772319dd3db1ec2b880dadca7f88a3d9cee8e22ca3L46-L50

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
Venatorscommented, Sep 13, 2022

The issue still seems to be present in v3.0.3 as well - my local is en-NZ (when checked with navigator.language) but Luxon is using en-GB (when checked with DateTime.local())

2reactions
robincsamuelcommented, Aug 10, 2022

@icambron Same issue on luxon 3.0.1. navigator.language prints the correct locale but luxon is still using en-GB.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript for detecting browser language preference [duplicate]
I have been trying to detect the browser language preference using JavaScript. If I set the browser language in IE in Tools>Internet Options>General>Languages...
Read more >
Preferred language settings are ignored or changed when in ...
If your Google Searches are using the wrong country service, the first thing to do is report the problem so Google can update...
Read more >
Why does Google use location for language rather than ...
The browser setting that every browser sends to any server it requests data from. Usually this defaults to the system language, but you...
Read more >
Solved: How to Detect a User's Locale in a Web App | Phrase
The codes for the locales match the ones in our browser settings ... When an explicit q value is not specified, a default...
Read more >
Can I set a different preferred language per site? - Super User
On Firefox, you can use the lightweight Quick Accept-Language Switcher extension and change the locale every time you access that site.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found