Skip to content
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

toLocaleString is not fully implemented in many environments #90

Closed
jsmreese opened this issue Dec 26, 2017 · 6 comments
Closed

toLocaleString is not fully implemented in many environments #90

jsmreese opened this issue Dec 26, 2017 · 6 comments
Milestone

Comments

@jsmreese
Copy link
Owner

Number#toLocaleString is not fully implemented in many environments, including IE10, IE11, Android, and others.

The moment duration format plugin should test the functionality of Number#toLocaleString before using it. And should employ a fallback version that implements those options used by the plugin.

See #68 and #69.

@jsmreese jsmreese added this to the 2.1.1 milestone Dec 26, 2017
@jsmreese
Copy link
Owner Author

jsmreese commented Dec 26, 2017

@mikeevstropov can you take a look at https://github.com/andyearnshaw/Intl.js
I think that if you were to add this lib to your project, everything might just work.

I'll check it out myself, but it might be a couple weeks before I'm able to.

@jsmreese jsmreese modified the milestones: 2.1.1, 2.1.2 Dec 30, 2017
jsmreese pushed a commit that referenced this issue Jan 13, 2018
@jsmreese jsmreese modified the milestones: 2.1.2, 2.2.0 Jan 13, 2018
@jsmreese
Copy link
Owner Author

@darkbluesun @mikeevstropov I've pushed a version of the plugin with a working fallback format function to the polyfill branch.

Using BrowserStack, all tests pass on IE 9 and 10, and Android 2.3, 4.4, and 6 in various browsers. Well, all tests except for two floating-point rounding errors when using the fallback format function (#93).

Please give this version a shot if you have a chance. I need to updated the documentation (may be a few days) before I publish the new version.

@christheyounger
Copy link

This fixes the behaviour in my app in IE10 👍

@jsmreese
Copy link
Owner Author

Thank you for testing @darkbluesun!

Pushed a new version to the polyfill branch that uses string-based rounding to fix #93 and #94 when using the fallback format function.

Ironically, IE11, Edge, and Windows Phone don't need to use the fallback format function, but they show those same floating point rounding errors when using toLocaleString. Gotta love JavaScript sometimes!

I still need to update the docs before publishing the new version.

@jsmreese
Copy link
Owner Author

Just published version 2.2.0 with the fallback function.

@christheyounger
Copy link

Thanks! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants