Jump to content

Incorrect number and currency JS format functions


Rubens Cury

Recommended Posts

Value returned by formatNumber and formatCurrency JS funcions:

formatNumber(1234567.56, 2, ',', '.')
"1,234,567.56"
formatNumber(-1234567.56, 2, ',', '.')
"-1234567.56"

formatCurrency(1234567.56, 1, 'U$', '')
"U$1,234,567.56"
formatCurrency(-1234567.56, 1, 'U$', '')
"U$-1234567.56"

Notice that negative values are not formatted correctly and both are losing the thousand separator.

 

May I'm doing something wrong?!

 

Thanks

Rubens M Cury

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...