overcast5348,

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?

schalkneethling,

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.

overcast5348,

Yup, that’s indeed the format used in some European countries. Canada was surprising though. 🤷‍♂️

towerful,

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.


<span style="color:#323232;">const formatter = Intl.NumberFormat(/* options */);
</span><span style="color:#323232;">return items.map(item => {
</span><span style="color:#323232;">   return {
</span><span style="color:#323232;">      ...item,
</span><span style="color:#323232;">      total: formatter.format(item.total)
</span><span style="color:#323232;">   }
</span><span style="color:#323232;">});
</span>

…Or however you choose to mutate an array.

Well, certainly it used to be. Not sure if that is still the case!

schalkneethling,

100% Agree

  • All
  • Subscribed
  • Moderated
  • Favorites
  • webdev@programming.dev
  • ethstaker
  • DreamBathrooms
  • InstantRegret
  • tacticalgear
  • magazineikmin
  • Youngstown
  • thenastyranch
  • mdbf
  • slotface
  • rosin
  • modclub
  • kavyap
  • cubers
  • osvaldo12
  • JUstTest
  • khanakhh
  • cisconetworking
  • Durango
  • everett
  • ngwrru68w68
  • Leos
  • normalnudes
  • GTA5RPClips
  • tester
  • megavids
  • anitta
  • provamag3
  • lostlight
  • All magazines