Open rochapablo opened 7 years ago
@rochapablo did you have any luck solving this? I'm having the same issue.
@gregholland, nop. I kind give up for now. I'm working in other areas and I'll let this for later.
Honestly I don't think this issue has to do with this lib. Under the hood it uses the browsers intl API which is what is using US$
instead of $
. So likely in testing this is the browser using a different locale than en-US. You can see in the polyfill what I mean: https://github.com/andyearnshaw/Intl.js/search?p=19&q=%22US%24%22&type=&utf8=%E2%9C%93
Oh and the formats
part of the intl file is mostly for shorthand.. so instead of typing {{formatNumber fooNum style="currency" currency="USD"}}
with a format you can just do {{formatNumber fooNum "bar"}}
where
var intlData = {
"locales": "en-US",
"formats": {
"number": {
"bar": {
"style": "currency",
"currency": "USD"
}
}
}
};
I honestly can't find good reason to use them.. seems hard to maintain.
I was able to solve the problem using singular 'locale' form:
{{formatNumber price style="currency" currency="USD" locale="en-US"}}
Need to use currencyDisplay: 'narrowSymbol' to display $ instead of US$ . Please refer https://stackoverflow.com/questions/52410407/intl-numberformat-currency-us-currency-symbol
I'm using
This is how I'm formatting
And here's my js file
Everything that I tried, or nothing happens or I got this error