11
top 5 comments
sorted by: hot top controversial new old
[-] towerful@programming.dev 6 points 5 months ago

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!

[-] schalkneethling@programming.dev 1 points 5 months ago
[-] overcast5348@lemmy.world 3 points 5 months ago

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@programming.dev 1 points 5 months ago

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@lemmy.world 2 points 5 months ago

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

this post was submitted on 05 Apr 2024
11 points (92.3% liked)

Web Development

3427 readers
1 users here now

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

Related Communities

Wormhole

Some webdev blogsNot sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

CreditsIcon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS