Question

How can i format currency related data in a manner that is culture aware in JavaScript?

Was it helpful?

Solution

there is a Number.localeFormat function but I'm not sure it's what your after

http://msdn.microsoft.com/en-gb/library/bb310813.aspx

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 */

Docs on MDN.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top