I don't understand how NumberFormat works.
In France we never use $US
so why do I get the following?
new Intl.NumberFormat("fr-FR",{
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2,
}).format("345")
"345,00 $US"
new Intl.NumberFormat("fr-FR",{
style: 'currency',
currency: 'EUR',
minimumFractionDigits: 2,
}).format("345")
"345,00 €"
Also: the following does not make any sense to me either. I tried random locales to see the impact and get different results for these 2:
new Intl.NumberFormat("en-HOS",{
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2,
}).format("345")
"345,00 $US"
new Intl.NumberFormat("en-HOSSDDG",{
style: 'currency',
currency: 'USD',
minimumFractionDigits: 2,
}).format("345")
"$345.00"
Is this API broken or I miss something?
$US
, why does the api return that? Isn't it intended to be used in real life formatting operations? – Heterozygote,
and.
characters, which should remain constant regardless of the currency you're dealing with, because you're French. But while browsing in France you may still use USD to pay for something online, check a US bank account, or exchange from euros, which is where thecurrency
param comes in, adding a prefix or suffix of$US
to the number but keeping the.
and,
formatting. – Redskin