1

My site currently quotes users in GBP, USD and EUR however it breaks whenever the user wishes to be quoted in Euros. This is because Euros need to be formatted with the thousands separated by , and the cents separated by a . e.g. €12.000.000,00

GBP £ - Correct

£12,000,000.00

GBP £ - Incorrect

£12.000.000,00

USD $ - Correct

$12,000,000.00

USD $ - Incorrect

£12.000.000,00

EUR € - Correct

£12.000.000,00

EUR € - Incorrect

$12,000,000.00

Is there a little jQuery script that can handle this? What is the best practice way of displaying data in multiple currencies?

Gravy
  • 12,264
  • 26
  • 124
  • 193
  • 1
    Possible duplicate of: [How can I format numbers as money in JavaScript?](http://stackoverflow.com/q/149055/82548). – David Thomas Mar 17 '13 at 10:33
  • Sorry, I don't really see the duplicate? – Gravy Mar 17 '13 at 10:39
  • Your question is (or seems to be) 'how can I format money appropriately using the correct separators?' Which is answered by the top-voted answer to the linked question, and is, effectively, the same question rephrased (albeit yours is a little-more specifically concerned with the locality/separators). – David Thomas Mar 17 '13 at 14:12
  • 1
    Sorry, but I see no mention of Euros on that page, no mention of different decimal and thousand separators dependent on currency. I see poorly formatted and commented code which is unreadable and minified which is useless to me. As such, if question is a dup... It's not helpful because I have no idea where on that page to look for my answer. – Gravy Mar 18 '13 at 10:29

1 Answers1

1

After a quick look on google, I founded a ton of plugins !

More deeply, I think that you need to parseFloat on numbers, omitting spaces and special chars. Than you'll have to count each number position to place the "dots" or "commas" where you need them to be according to the currency.

There's a lot to do to make all currencies to work, so I would try this lovely plugin, which seems to be exactly what you need !

soyuka
  • 8,839
  • 3
  • 39
  • 54