Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

The `Intl` object in JS is so valuable, yet so underutilized Learn how to generate friendly relative time strings from a given date - like "in 10 minutes" or "last week" or "tomorrow" - with 0 dependencies in my latest blog post:

267,858 Aufrufe • vor 3 Jahren •via X (Twitter)

10 Kommentare

Profilbild von Steve (Builder.io)
Steve (Builder.io)vor 3 Jahren

More of what you can do with `Intl.RelativeTimeFormat`, and some other super handy things you can do with `Intl`, in the full article:

Profilbild von Awa!s
Awa!svor 3 Jahren

Which software do you use for recording videos?

Profilbild von someone
someonevor 3 Jahren

@theankurkedia check that out bro

Profilbild von n_oway
n_owayvor 3 Jahren

nice one, the Spanish translation for the last one should be 'en 10 minutos' but seems to come back in English 🙃

Profilbild von Steve (Builder.io)
Steve (Builder.io)vor 3 Jahren

doh, bad copy paste, will fix, thank you!

Profilbild von Koray 😷
Koray 😷vor 3 Jahren

works good with money too. new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' } ).format(money);

Profilbild von Noah Vandervelden
Noah Vanderveldenvor 3 Jahren

Didn’t know how useful this was until working with currency in a recent project! Completely changed how I did currency, time, and a lot of other things Intl had to offer

Profilbild von RodAvi
RodAvivor 3 Jahren

Awesome tip Steve, thanks a lot. !!!

Profilbild von const name = 'David';
const name = 'David';vor 3 Jahren

This is great. Thanks for this. I have a collection of utility functions I use that keep me from needing things like lodash. I'm currently using date-fns, but need to see if this might be near enough to remove that dependency as well.

Profilbild von AleqsBrujo
AleqsBrujovor 3 Jahren

I like your tips! Ty for the research and most important for sharing it<3

Ähnliche Videos