Open utterances-bot opened 2 years ago
How to format currency with default locale?
@NishantJS you can use undefined
as the provided locale:
const number = 123456.789;
const myNum = new Intl.NumberFormat(
undefined, //locale, use user default
{
notation: "compact",
compactDisplay: "short"
}
).format(number));
console.log(myNum)
Format currency with Intl
Use Intl.NumberFormat() to convert currency, units, notation, and other numeric values
https://fireship.io/snippets/currency-formatting/