Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

It's 2026. You don't need a library for formatting dates in JavaScript. Just use Intl 👇

148,678 Aufrufe • vor 10 Monaten •via X (Twitter)

36 Kommentare

Profilbild von Asmir
Asmirvor 10 Monaten

@YBenlemlih For better performance, use

Profilbild von kkkooo
kkkooovor 10 Monaten

@YBenlemlih It’s 2026, why not use Temporal🤨

Profilbild von Alexander Codes
Alexander Codesvor 10 Monaten

@YBenlemlih how do you make these code animations?

Profilbild von Josef Bender
Josef Bendervor 10 Monaten

👇

Profilbild von Alexander Codes
Alexander Codesvor 10 Monaten

@YBenlemlih thank you!

Profilbild von Kayvan Arianpour
Kayvan Arianpourvor 10 Monaten

@YBenlemlih Unfortunately JS does not handle the timezone issue well. If you don’t have this issue, good for you. I will wait for Temporal. Till then, still in 2026, I use date-fns

Profilbild von Lingo.dev
Lingo.devvor 10 Monaten

@YBenlemlih That’s great news 👍

Profilbild von aymericzip
aymericzipvor 10 Monaten

@YBenlemlih I guess 2026 has to be formatted using Intl

Profilbild von Samador 🔥
Samador 🔥vor 10 Monaten

@YBenlemlih There's 'toLocaleString()' which I believe you'll easily remember. Works the same as Intl

Profilbild von Yash Solanki
Yash Solankivor 10 Monaten

@YBenlemlih but library still makes the job much easier. I use dayjs, and it works seamlessly i'l save this for the future, thanks!!

Profilbild von Ann Liao
Ann Liaovor 10 Monaten

@YBenlemlih What's the different between this and dayjs?

Profilbild von Anish B Ghosh
Anish B Ghoshvor 10 Monaten

@YBenlemlih javascript has so many hidden treasures. it's good to have a treasure hunter like you amongst us.

Profilbild von RubyWithoutRailsWithStaticTypes
RubyWithoutRailsWithStaticTypesvor 10 Monaten

@YBenlemlih Technically we never needed any libraries, even back in the jquery days. But JavaScript sucks on every level, and everyone desperately attempts to use band aids & duct tape

Profilbild von Ville Saukkonen
Ville Saukkonenvor 10 Monaten

@YBenlemlih Intlesting 🤔

Profilbild von Colin Richardson
Colin Richardsonvor 10 Monaten

@YBenlemlih "You don't need a library".. except, you kinda do. Because, yes, you got the correct format.. but you got the wrong timezone.. 14:35:20Z is gonna be like 8:35AM for most of America right?

Profilbild von Cody
Codyvor 10 Monaten

@YBenlemlih i knew intl was the move years ago

Profilbild von Subhadip Mishra
Subhadip Mishravor 10 Monaten

@YBenlemlih New update

Profilbild von Justin Schroeder
Justin Schroedervor 10 Monaten

@YBenlemlih For more control and parsing:

Profilbild von Gamatek 🇫🇷
Gamatek 🇫🇷vor 10 Monaten

@YBenlemlih same for time, number etc

Profilbild von Renato Carneiro
Renato Carneirovor 10 Monaten

@YBenlemlih date-fns

Profilbild von Beka
Bekavor 10 Monaten

@YBenlemlih My AI agent already used this

Profilbild von Hamza Ahmad
Hamza Ahmadvor 10 Monaten

@YBenlemlih Absolutely!

Profilbild von Ankit Mohanta
Ankit Mohantavor 10 Monaten

@YBenlemlih There are tons of npm packages that do the same thing and export their custom hooks and functions, but under the hood, they are using this exact utility

Profilbild von Sanchita
Sanchitavor 10 Monaten

@YBenlemlih

Profilbild von Romain
Romainvor 10 Monaten

@YBenlemlih Happened to me today : ki() is compiled name for Angular's formatDate() function. Silly us trying to format a string instead of a Date, but 1) it doesn't bother Angular as it still tries to cast to a Date then format 2) it was doing fine with "2025-12-23" soooo

Profilbild von Sevalla
Sevallavor 10 Monaten

@YBenlemlih JS has some hidden gems.

Profilbild von Ypatios Chaniotakos
Ypatios Chaniotakosvor 10 Monaten

@YBenlemlih Cool

Profilbild von Andrii Shupta
Andrii Shuptavor 10 Monaten

@YBenlemlih In more complex apps, formatting is only ~10% and using Luxon (and other libs) gives better api and more functionality: timezones/offsets, add/remove days/minutes, startOf/endOf, from/to ISO, DateTime<isValid?>, etc

Profilbild von Adetunji | Software Engineer (Web & Mobile)
Adetunji | Software Engineer (Web & Mobile)vor 10 Monaten

@YBenlemlih This is so cool I learn it this year and never installed a library again

Profilbild von Habibur Rahman
Habibur Rahmanvor 10 Monaten

@YBenlemlih I am happy that JS has this built-in but the DX of date-fns is way better

Profilbild von Hosein Hamzenejadi
Hosein Hamzenejadivor 10 Monaten

@YBenlemlih I used to use moment.js Intl is much better and it's native

Profilbild von blank
blankvor 10 Monaten

@YBenlemlih I guess this is the end of the road for me with date-fns.

Profilbild von thym
thymvor 10 Monaten

@YBenlemlih cool animation!

Profilbild von tanav
tanavvor 10 Monaten

@YBenlemlih Crazy library

Profilbild von Glitchmon
Glitchmonvor 10 Monaten

@YBenlemlih Bro prepared the post for next year's algo

Profilbild von Marwan Baz
Marwan Bazvor 10 Monaten

@YBenlemlih The new animation posts are really nice, and they are going viral 🚀

Ähnliche Videos