Its worth creating an Intl formatter outside of a loop, then applying it inside the loop - if you are formatting everything in the loop the same.
const formatter = Intl.NumberFormat(/* options */); return items.map(item => { return { ...item, total: formatter.format(item.total) } });
…Or however you choose to mutate an array.
Well, certainly it used to be. Not sure if that is still the case!
100% Agree
I live in Canada and I’ve never seen “1.000,00”. Canada (at least the anglophone part that I live in) follows the usual “1,000.00” format. Why is this library using commas as decimal separators?
This is very interesting. I agree that some of the formatting puzzled me as well. I would assume this follows some standard even when the use of said standard is uncommon. I have for example not seen 1.000,00 € used, but I thought that perhaps if you live in Germany, France, or another EU country then it is common.
Yup, that’s indeed the format used in some European countries. Canada was surprising though. 🤷♂️