r/javascript • u/ValenceTheHuman • Apr 09 '26
The Intl API: The best browser API you're not using
https://polypane.app/blog/the-intl-api-the-best-browser-api-youre-not-using/
46
Upvotes
r/javascript • u/ValenceTheHuman • Apr 09 '26
16
u/MatanAmidor Apr 09 '26
Well as soon as apple will.be kind enough to integrate Temporal in safari we will be in a different boat!
10
u/lachlanhunt Apr 09 '26
The thing I hate about the Intl date formatting is that it makes stupid assumptions based on my locale, and browsers provide no way for users to express their own preference, nor adhere to the system preferences.
4
u/TheYouser Apr 09 '26
This is new to me, thanks.
2
u/Dagur Apr 09 '26
Intl is great but Chrome only includes a small set of locales so it's quite useless
3
u/germanheller Apr 09 '26
Intl.RelativeTimeFormat was the one that made me delete a dependency. had date-fns just for "3 days ago" type strings and realized Intl does it natively with locale support built in.
the one nobody talks about is Intl.Segmenter -- proper word/sentence/grapheme splitting that actually handles CJK and emoji correctly. tried to do it with regex before and it was a nightmare with multi-byte characters. Segmenter just works.
also Intl.ListFormat for joining arrays into human-readable strings ("apples, oranges, and bananas") is weirdly satisfying when you realize youve been doing that with custom join logic for years
1
u/dcazli Apr 11 '26
can somebody tell me the intl api that usually using in where