-
Notifications
You must be signed in to change notification settings - Fork 748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Local Week year is wrong on Firefox for en-US
, fr-CA
(locales with weeks starting on Sunday).
#1563
Comments
Yep, Running this: DateTime.now().endOf('week', { useLocaleWeeks: true }).toFormat('EEEE'); returns It looks like the fix for this is to set this: Settings.defaultWeekSettings = { firstDay: 7, minimalDays: 1, weekend: [6, 7] } |
Relevant Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1693576 An alternative is to use a polyfill: https://formatjs.io/docs/polyfills/intl-locale |
I get that it would be ideal to have the browser inform the library of what it believes the locale info is, but honestly it seems kind of strange to have to do all of this configuration just so I can have consistent behavior across browsers |
@ChrisMBarr This is unfortunately the world we live in. Luxon's place is to provide a nicer API abstracted away from the various Intl APIs. Luxon was specifically born to not have to ship locale and time zone data like this and instead rely on the Intl APIs. It's the job of the library user to ensure their platform support the needed features or fill them in with a polyfill. The documentation here could definitely be improved though, especially with relevant links for how to work around various shortcomings. |
I don't know anything about how the internals of Luxon work. but perhaps there could be some sort of polyfill that is recommended to use if you need Firefox support. Something that would wither mimic Or at the very least a big banner on the docs that says "Hey, all week information will be incorrect in Firefox unless you do this" Just something to make it usable so you can trust Luxon. I love the API but now I find myself second guessing everything, checking it in all browsers, and writing extra unit tests... and now I might have to find a way to run my unit tests in multiple browsers. |
I recommended a polyfill above that you can use. |
When I linked to it the other day it still worked, I am guessing their certificate just expired. I am surprised you are seeing many failures - are they all related to the missing locale week support? |
When I say "failures" i just mean that I have some date parsing/transformation stuff that is just outputting stuff I'm not expecting. Part of it turned out to be a testing issue where those All good now thankfully! |
I'm opening this bug for tracking purposes,
Currently the week year format (
iiii
) can be wrong on firefox because it doesn't supportgetWeekInfo
and Luxon uses the following fallback (which is the ISO definition I believe):luxon/src/impl/locale.js
Lines 320 to 324 in 3125686
The text was updated successfully, but these errors were encountered: