-
Notifications
You must be signed in to change notification settings - Fork 5
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
ONL-4443: fix: Fixed the way how decimal separator and group separator are detected #156
ONL-4443: fix: Fixed the way how decimal separator and group separator are detected #156
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/ebury/chameleon/asnpy8sfw |
Splendid work 👏 I know we might be penalizing 🇸🇪 clients, but would it be possible to just add the polyfill for those? |
I'm not sure it will that easy. I checked how many locales are affected by this bug: 37! Locales which should be using empty space:
Locales which should be using dot:
Locales which should be using apostrophe:
Locales which should be using different kind of apostrophe:
and then there is I wonder if this bug happens to somebody who installed Chrome/Chromium in Sweden ... |
I also discovered that |
ugh, way too many edge cases, shall we add the polyfill always then? thanks for the investigative work 🕵️ |
I wouldn't TBH, none of these locales are supported by EBO. It might be a problem for somebody who uses this library in their application and needs proper support for all of them. In that case I'd recommend them to polyfill it properly in their app and don't ship any polyfill with chameleon-components. Maybe we should write a note in README about this issue. |
584a0ed
to
2c63329
Compare
good call, let's go with the note in the README 👍 |
9145d1f
to
a1936b1
Compare
Amount input uses Intl API for detecting decimal and grouping separator:
But the problem is that
formatToParts
doesn't exist on IE11. There is a polyfill but not for NumberFormat. So I wrote our own detection and validated it against all locales in the world that are shipped withintl
package.I found strange behaviour of my functions for Swedish locale, where
. I run the same test with
getGroupingSeparator
returns ',' instead of empty spaceformatToParts
function and I got the same bug. This is happening only on Chromium browsers, while Firefox and IE11! got it right. It seems like there is a bug in Chromium not having some locales installed and it falls back to en-US settings. Solution for this would be to start using Intl polyfill on every single browser and ignore built-in Intl:^^ that's 70KB polyfill, 15.5KB gzipped.