formatjs / handlebars-intl

Handlebars helpers for internationalization.
http://formatjs.io/handlebars/
Other
265 stars 28 forks source link

Currency formatting incorrect when no 'cents' in value. #77

Closed beldougie closed 8 years ago

beldougie commented 8 years ago

I am trying to use the helper in a partial, but if we pass a value such as 100.00 to the helper, we are given a value of $100 when it should be $100.00. How do I fix this? If I have a non-zero value in the decimal places, ie: 100.30 there is no problem, the value is formatted correctly. I have tried setting the locales explicitly and ensured that a float not an integer is being passed to the helper (although, this should probably work with an integer as well.

Please advise.

beldougie commented 8 years ago

Issue solved - It's not very well documented on the Handlebars-Intl site, but I found the solution via this page:

Simply add another option minimumFractionDigits=2 to the end of the numberFormat helper in the template and the problem is solved.