joejuzl / jquery-formatcurrency

Automatically exported from code.google.com/p/jquery-formatcurrency
GNU General Public License v3.0
0 stars 0 forks source link

Unable to Switch Formats #40

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a text field.
2. Enter a plain number in the field, e.g. 1500
3. Use the formatCurrency to format it as a specific region, e.g. fr-FR
4. Use the formatCurrency to format it as a different region, e.g. en-CA
5. Call formatCurrency's asNumber function.
6. The raw number is different.

What is the expected output? What do you see instead?

I'd expect format currency to switch between formats while retaining the 
original number value (so switching formats does not change your raw number).

What version of the product are you using? On what operating system?

Version 1.4.0, Windows 7, Chrome.

Please provide any additional information below.

What's happening is format currency is just removing non-numeric symbols from 
the number, then formatting the number. So if you switch formats, your number 
will change because it's not actually converting it back to a raw number first 
(it's just removing all the symbols and re-formatting that number).

Original issue reported on code.google.com by LindsayM...@gmail.com on 7 May 2013 at 12:21

GoogleCodeExporter commented 8 years ago
I'm still trying to resolve this problem. I tried calling .toNumber({region: 
'fr-FR'}) before formatting the field as a different region, but that didn't 
help. Both toNumber() and asNumber() don't recognize decimal places when using 
the fr-FR format and I get incorrect raw numbers back.

Original comment by LindsayM...@gmail.com on 7 May 2013 at 7:34