Singapore dollar (SGD) does not resolve to its sign: $. https://en.wikipedia.org/wiki/Singapore_dollar
Not sure where to direct that issue. Here or formatjs?
Which browser?
This is a Chrome bug, try this in Firefox and you'll see it's correct:
new Intl.NumberFormat('en-SG', {style: 'currency', currency: 'SGD'}).format(1);
Chrome has a similar issue with INR: #231
@ericf
var nf = Intl.NumberFormat(['en-sg'], {style:'currency', currency:'SGD', currencyDisplay:'symbol'});
What setup is required to achieve the above with react-intl FormattedNumber? Must I load sg localeData?
<FormattedNumber value={value} style='currency' minimumFractionDigits={0} maximumFractionDigits={0} currency={'SGD'} />
I have the same issue. I still get SGD instead of S$
SGD
S$
A way around can be by manually inserting the SGD symbol as an exception to other currencies:
`const formatCost = (cost, currency = "USD") => { let formatter = new Intl.NumberFormat('en-US', { style: 'currency', currency: currency, }) //because Intl.NumberFormat doesn't support SGD if (currency === 'SGD') { formatter = new Intl.NumberFormat('en-US', { style: 'decimal', }) return 'S$' + formatter.format(Number(cost)) }
return formatter.format(Number(cost)) }`
Activity
ericf commentedon Jan 5, 2016
Which browser?
ericf commentedon Jan 5, 2016
This is a Chrome bug, try this in Firefox and you'll see it's correct:
Chrome has a similar issue with INR: #231
SavageWilliam commentedon Jan 12, 2019
@ericf
What setup is required to achieve the above with react-intl FormattedNumber?
Must I load sg localeData?
arvinsim commentedon Apr 16, 2021
I have the same issue. I still get
SGDinstead ofS$orkunozekin commentedon Jun 8, 2022
A way around can be by manually inserting the SGD symbol as an exception to other currencies:
`const formatCost = (cost, currency = "USD") => {
let formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: currency,
})
//because Intl.NumberFormat doesn't support SGD
if (currency === 'SGD') {
formatter = new Intl.NumberFormat('en-US', {
style: 'decimal',
})
return 'S$' + formatter.format(Number(cost))
}
return formatter.format(Number(cost))
}`