Загрузка видео...

Не удалось загрузить видео

На главную

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

148,678 просмотров • 10 месяцев назад •via X (Twitter)

Комментарии: 36

Фото профиля Asmir
Asmir10 месяцев назад

@YBenlemlih For better performance, use

Фото профиля kkkooo
kkkooo10 месяцев назад

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

Фото профиля Alexander Codes
Alexander Codes10 месяцев назад

@YBenlemlih how do you make these code animations?

Фото профиля Josef Bender
Josef Bender10 месяцев назад

👇

Фото профиля Alexander Codes
Alexander Codes10 месяцев назад

@YBenlemlih thank you!

Фото профиля Kayvan Arianpour
Kayvan Arianpour10 месяцев назад

@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

Фото профиля Lingo.dev
Lingo.dev10 месяцев назад

@YBenlemlih That’s great news 👍

Фото профиля aymericzip
aymericzip10 месяцев назад

@YBenlemlih I guess 2026 has to be formatted using Intl

Фото профиля Samador 🔥
Samador 🔥10 месяцев назад

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

Фото профиля Yash Solanki
Yash Solanki10 месяцев назад

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

Фото профиля Ann Liao
Ann Liao10 месяцев назад

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

Фото профиля Anish B Ghosh
Anish B Ghosh10 месяцев назад

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

Фото профиля RubyWithoutRailsWithStaticTypes
RubyWithoutRailsWithStaticTypes10 месяцев назад

@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

Фото профиля Ville Saukkonen
Ville Saukkonen10 месяцев назад

@YBenlemlih Intlesting 🤔

Фото профиля Colin Richardson
Colin Richardson10 месяцев назад

@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?

Фото профиля Cody
Cody10 месяцев назад

@YBenlemlih i knew intl was the move years ago

Фото профиля Subhadip Mishra
Subhadip Mishra10 месяцев назад

@YBenlemlih New update

Фото профиля Justin Schroeder
Justin Schroeder10 месяцев назад

@YBenlemlih For more control and parsing:

Фото профиля Gamatek 🇫🇷
Gamatek 🇫🇷10 месяцев назад

@YBenlemlih same for time, number etc

Фото профиля Renato Carneiro
Renato Carneiro10 месяцев назад

@YBenlemlih date-fns

Фото профиля Beka
Beka10 месяцев назад

@YBenlemlih My AI agent already used this

Фото профиля Hamza Ahmad
Hamza Ahmad10 месяцев назад

@YBenlemlih Absolutely!

Фото профиля Ankit Mohanta
Ankit Mohanta10 месяцев назад

@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

Фото профиля Sanchita
Sanchita10 месяцев назад

@YBenlemlih

Фото профиля Romain
Romain10 месяцев назад

@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

Фото профиля Sevalla
Sevalla10 месяцев назад

@YBenlemlih JS has some hidden gems.

Фото профиля Ypatios Chaniotakos
Ypatios Chaniotakos10 месяцев назад

@YBenlemlih Cool

Фото профиля Andrii Shupta
Andrii Shupta10 месяцев назад

@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

Фото профиля Adetunji | Software Engineer (Web & Mobile)
Adetunji | Software Engineer (Web & Mobile)10 месяцев назад

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

Фото профиля Habibur Rahman
Habibur Rahman10 месяцев назад

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

Фото профиля Hosein Hamzenejadi
Hosein Hamzenejadi10 месяцев назад

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

Фото профиля blank
blank10 месяцев назад

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

Фото профиля thym
thym10 месяцев назад

@YBenlemlih cool animation!

Фото профиля tanav
tanav10 месяцев назад

@YBenlemlih Crazy library

Фото профиля Glitchmon
Glitchmon10 месяцев назад

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

Фото профиля Marwan Baz
Marwan Baz10 месяцев назад

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

Похожие видео