JavaScript culture sensitive currency formatting
-
09-06-2019 - |
Question
How can i format currency related data in a manner that is culture aware in JavaScript?
Solution
there is a Number.localeFormat function but I'm not sure it's what your after
OTHER TIPS
Dojo has a currency formatter that's locale aware.
If you don't want to include Dojo in your project just for this function, then perhaps you can localize the currency in your back-end?
Number.toLocaleString (implemented in JavaScript 1.5, ECMAScript 3rd Edition)
var number = 3500;
console.log(number.toLocaleString()); /* Displays "3,500" in English locale */
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow