If you take a look a this code, please note that even both maximumFractionDigits
and minimumFractionDigits
are set to 2 the output contains 3 decimals
const amount = 1200.5422222222;
const precision = 2;
const currency = '€'
const prettyAmount = new Intl.NumberFormat('en-US').format(amount, {
maximumFractionDigits: precision,
minimumFractionDigits: precision,
style: 'currency',
currency: 'USD'
})
console.log(prettyAmount) // outputs: 1,200.542
I tried also with only the maximumFractionDigits
and result is the same,
how should I do it?