Loading video...

Video Failed to Load

Go Home

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,870 views • 3 years ago •via X (Twitter)

10 Comments

Steve (Builder.io)'s profile picture
Steve (Builder.io)3 years ago

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

Awa!s's profile picture
Awa!s3 years ago

Which software do you use for recording videos?

someone's profile picture
someone3 years ago

@theankurkedia check that out bro

n_oway's profile picture
n_oway3 years ago

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

Steve (Builder.io)'s profile picture
Steve (Builder.io)3 years ago

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

Koray 😷's profile picture
Koray 😷3 years ago

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

Noah Vandervelden's profile picture
Noah Vandervelden3 years ago

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

RodAvi's profile picture
RodAvi3 years ago

Awesome tip Steve, thanks a lot. !!!

const name = 'David';'s profile picture
const name = 'David';3 years ago

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.

AleqsBrujo's profile picture
AleqsBrujo3 years ago

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

Related Videos