Тёмный

Formatting Is So Easy With The Intl JavaScript API 

Web Dev Simplified
Подписаться 1,6 млн
Просмотров 42 тыс.
50% 1

Опубликовано:

 

8 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 46   
@robertholtz
@robertholtz Год назад
OMG, I wrote a rather complex code block that has been live for about 2 years now that I was quite proud of until watching this video and reaching the realization that I could’ve done it much more simply using RelativeTimeFormat. I’m conflicted now on just leaving that code alone (since it has been running trouble-free for such a long time now) or going back to refactor. Here I’ve been contented, thinking that routine was fully optimized. Thanks, Kyle, for putting the spotlight on Intl. This is truly eye-opening and will definitely affect my future projects.
@WebDevSimplified
@WebDevSimplified Год назад
Honestly, I would just leave it as is unless you need to update the code or add to it. Most likely the refactor would be pretty quick, though, so you could do it if you want to.
@robertholtz
@robertholtz Год назад
​@@WebDevSimplified Funny you should say that. I opened up my source all motivated to refactor but stopped myself at the last minute. Over the years, part of how I know I continue to progress as a developer is my newest code almost always looks better to me than my older code. But, every so often (stating it as humbly as possible), I look back and think, "Wow, that's good work. I did a good job." It's a rare but satisfying feeling to look at your past efforts and appreciate the quality of your logic and the elegance of your implementation. This particular code is especially solid, works universally, has no special dependencies, and has caused zero problems for all its users so, in the end, I decided to leave it be. I'm glad your advice on the matter turned out to be along the same lines. A refactor would probably be fairly quick but I think it's a good discipline to let your code go once you know it to be stable. If your code doesn't embarrass you when you look back on it with new eyes, it's probably optimal, at least in the practical real-world sense. That's my personal view on the matter for whatever it's worth. Nevertheless, I made myself an abstraction so I can get sharp on the ins and outs of Intl for future projects. And I'm still immensely grateful to you for shedding light on this gem. I am sure I'm not alone for having overlooked all the useful capabilities hiding in Intl under the false assumption that it only pertained to situations requiring a lot of user localization. No question this will definitely be part of my arsenal going forward. So, thank you again, Kyle. Please keep up the great work. I appreciate you immensely and often get great value and insights from your videos. Take pride in knowing you are a force for good in this world. Cheers!
@mohammedsaber6782
@mohammedsaber6782 Год назад
Good job I'm using it to convert from gregorian to Islamic dates and vice versa.
@Microphunktv-jb3kj
@Microphunktv-jb3kj Год назад
is this some new web api or.. all those moment.js or date.fns type libs are based on this ?
@elhaambasheerch7058
@elhaambasheerch7058 Год назад
Such a great video Kyle ! You really are making web development simple for all of us.
@RichReflectionz
@RichReflectionz Год назад
This is awesome, as a new frontend dev, I can’t wait to utilise this
@Sarev_
@Sarev_ Год назад
Really interesting video. I had no idea something like this exists.
@rasul7702
@rasul7702 6 месяцев назад
Omg, when I watched this video I sat and smiled with happiness. Thank you!!!
@ozzyfromspace
@ozzyfromspace Год назад
I had a "jaw moment" learning this from you, Kyle. Thanks for the video, the hype about Intl was well deserved. I've solved most of the problems you brought up with libraries like date-fns, or wacky one-time code. Now an Intl fan boy lol. Also, it occurred to me that if you can apply a bunch of formatters to dates specifically, it's probably best to keep them in standard ISO format. I tend to be pretty inconsistent about this, but will basically always store times as such going forward. For anyone with knowledge, is conversion from a date string to date object considered a "slow" operation in javascript?
@soniablanche5672
@soniablanche5672 Год назад
Subtle WebCrypto is my favorite :^)
@suyashsrivastava3671
@suyashsrivastava3671 Год назад
Recently used it in a project , really fun to use .
@harmez7
@harmez7 10 месяцев назад
yeah it tickles
@petarkolev6928
@petarkolev6928 Год назад
This is so useful! I will have soon such thing to implement and instead of installing 3rd party lib this will do the trick perfect! Love it 🍻
@anonymously-rex-cole
@anonymously-rex-cole Год назад
bruh i was just looking for this in the past 20 mins an then you upload this. 🤭😄🤯
@adampielach4942
@adampielach4942 Год назад
Good to know. I wonder if Intl will have more convenient utilities that will enable us to replace libraries such as date-fns for basic formatting and dates comparisons, for example.
@yukiarimo
@yukiarimo Год назад
Thanks, saved a lot of time!
@nomadshiba
@nomadshiba Год назад
im really happy that browsers started to include common things built-in so user doesnt need to download it
@sadamali6691
@sadamali6691 Год назад
Fantastic lesson thank you for your sharing this helpful lesson. Greating you from Somalia 🇸🇴
@smartjefreycoca5425
@smartjefreycoca5425 Год назад
thanks.. this helps me a lot specially the number format
@27sosite73
@27sosite73 8 месяцев назад
ty mr.Kyle
@victory_lucky
@victory_lucky Год назад
This is cool, I mostly love the NumberFormat
@brijeshdave
@brijeshdave Год назад
Hey kyle ! Thats an awesome content you have shared as like others you create often. Please create some real word enterprise web application tutorial if you can.
@kislaykumarsatyarthi6045
@kislaykumarsatyarthi6045 Год назад
I love your teaching. wanted you to make a video on nodeJs architecture fully covered. it would be so awesome if you can make a video on it.
@risingrave3549
@risingrave3549 Год назад
It’s so cool!
@kaustavroy6542
@kaustavroy6542 Год назад
Awesome video as always
@theisoj
@theisoj Год назад
Thanks Kyle as always 👍
@LePhenixGD
@LePhenixGD Год назад
Allow to clarify a little bit more on how you can use the PluralRules subclass The PluralRules subclass of the Intl API in JavaScript helps developers with pluralization, which is choosing the right word form based on the grammar rules of a language. Let's take Kyle's example about, in French, the word "mouse" ("souris") does not change form depending on the quantity, but lets say the user wants the website to be in English: const pluralRule = new Intl.PluralRules("en"); function getFormedAmountOfMice(quantity) { const formedQuantity = pluralRule.select(quantity); switch (formedQuantity) { case 'one': return `${quantity} mouse`; case 'other': return `${quantity} mice`; } } The function returns a string that displays the correct form of the word based on the plural form selected by the pluralRule object
@anhqui19822011
@anhqui19822011 Год назад
Not related to this video. But I'd like to say Congrats for your new house. 👏
@pioSko
@pioSko Год назад
WOw.. why didn't I know this? I think I should read the documentation more often
@aceentertainment2172
@aceentertainment2172 Год назад
Also known as Localization, very useful tool in JS
@nomadshiba
@nomadshiba Год назад
5:50 tip: you can can add the "n" prefix to write BigInt(s) like `const foo = 573489573494238945729n`
@ialkusudi6328
@ialkusudi6328 Год назад
Hi Kyle, I have a question, is it still relevant to learn React Native or should I choose Flutter for mobile application development?
@damiloladolor8067
@damiloladolor8067 Год назад
does the currency formatter work for crypto currencies like USDT, MATIC etc
@GaneshSingh1
@GaneshSingh1 Год назад
What is the best way to cobvert UTC date to CET or IST time by checking user location
@deepitasaha195
@deepitasaha195 Год назад
Hi dear... Can you explain when and how to use eval? Please ...
@mohitsen780
@mohitsen780 Год назад
Please make React-Native videos !!
@septimusforster
@septimusforster 7 месяцев назад
Senior man...
@OgyXD
@OgyXD Год назад
Best channel for web development
@getsetalk
@getsetalk Год назад
How to convert timestamp to human readable time in js
@7heMech
@7heMech Год назад
Didn't you already cover this?
@Nitish_T
@Nitish_T Год назад
First view🎉
@Pareshbpatel
@Pareshbpatel Год назад
{2023-04-12}
@morningstar-1112
@morningstar-1112 Год назад
Is this replacement of moment.js?
@ElektrykFlaaj
@ElektrykFlaaj Год назад
Dayjs is the real replacement of moment.js. It does the same things but has much smaller bundle size and is faster
Далее
I Waited 15 Years For These New Array Methods
8:11
Просмотров 222 тыс.
Why Signals Are Better Than React Hooks
16:30
Просмотров 474 тыс.
Are You Making These CSS Height Mistakes?
8:54
Просмотров 129 тыс.
The Async Await Episode I Promised
12:04
Просмотров 1,1 млн
Decrease Next.js Docker Image Size 15x
5:36
Просмотров 14 тыс.
The Power of JS Generators by Anjana Vakil
36:10
Просмотров 165 тыс.
Node.js is a serious thing now… (2023)
8:18
Просмотров 644 тыс.
This Is Unbelievably Powerful
11:15
Просмотров 103 тыс.
Top 6 React Hook Mistakes Beginners Make
21:18
Просмотров 571 тыс.