Formatting dates and times in JavaScript just got WAY easier!
HTML-код
- Опубликовано: 16 авг 2024
- Let's talk date and time formatting, shall we? Good. I'm going to make a custom element that neatly wraps a date/time value and makes it relative to the current time!
The specifics of the code can be found here! github.com/pau...
More info on Intl.RelativeTimeFormat at MDN (developer.mozi...) and the v8 blog (v8.dev/feature...) Наука
You're seriously underrated. I don't mind if you make a couple of click-bait YT-algo friendly videos just to gain more visibility. You know, like 'Working at FAANG sucks', 'Google Dev reacts....' or 'You're doing it wrong...' etc. It's shallow but at least you can get the attention of the noob devs and level us up. I'm binge-watching all of your videos rn after finishing a marathon on HTTP 203 after I first stumbled upon Google IO shorts I think. Thank you for your great content! I hope you don't abandon this channel.TT
"I know it exists" always makes chuckle, you deserve a like just for these moments alone. Love your work! :D
Well, sometimes the tech deserves the world's biggest eyeroll
Thank you Paul For the video....I just watched previous two videos in reverse order...Nice to have heads up for me in typescript....Getting positive vibes from you...
Welcome!
Where are you man. Missing you and your videos
The difference with innerText and textContent is that innerText gets the text only while textContent will grab style or script tags and their content
Oh yah I forget the details of those two regularly
:slotted() is valid css and can be used for styling slots. Parentheses can be used to further define the selector of a slot
Yes but often I find it more useful to surround the slot and deal with its parent.
just found your channel, great content
Probably a dumb question but why do you use id’s instead of classes for slotted-value and output. What happens when there’s more than one of these in the DOM?
Not a dumb question. IDs are resolved at the shadow DOM level, not globally. So each shadow root could contain an id of "foo" and that would be just fine.
I really love you make these videos with all the mistakes you make or the things you don't remember well, that allow me to see that even big leaguers programmers have the same issues than me lol...
It's why I do it. None of us need to feel bad about that kind of stuff.
Nice and clean code in Github repo ). Pleasant to look at!
I try
This channel is on the way to be one of the most famous channels for developers
Great videos, mate. Hope you make some more soon!
Thanks for the video Paul. I didn't know about slotchange event, and I really needed it few weeks ago :) later is better than never
Little big things
Niiiiice ! We need this !!! Hoping it will be released in all major browsers soon
The repo code has a fallback ;)
thanks for covering most important aspect in JavaScript 🙏🙏
Did you just call ISO 8601 _not_ human readable??!
I guess?
I rly like to watch it! Waiting for the next one :)
Where did you go?
Paul: "I know it exists"
Narrator: "But it did not exist"
😂 "Paul had missed the #"
Well done Paul!
Subscribed!
I love your vids. I'm doing recordings for Egghead as well for some years now. Just a quick question. What music do you use in the background? Is it some free playlist? Love it! thx & sorry for the "meta-question" 😉
It's from Epidemic Sound :)
@@aerotwist cool, gonna check it out, thx :)
what's your vs code theme paul?
спасибо
a little bit off topic, but why you did customElements.define in a different file? I mean just one line doesn't make any difference, but it can be sparse. any particular reasons?
I recently changed to doing this because of it being a side-effect. Depending on how you bundle sometimes you can find that you end up attempting to register the class multiple times, which fails. Also, as I say, I prefer keeping the import / export clean and avoiding side-effects.
Paul senpai, new video pleaaaase 😢
Where are you Paul?
Could you please make videos on basic js ts things with the examples? It will be good for us. Your current videos are too overwhelming. Thank you!
How are you? What’s up?
Dear Paul, could you explain the ! after .querySelector('#relative-value') ? What does it do, how does it work? By the way, thanks for the great video!
It's just a shorthand for TypeScript to tell it that you won't be expecting (and therefore dealing with) a null value
Thanks!
Hi Paul, why don't you use litelement? Thx for vid btw ;)
I could do. Just didn't today. Not everyone is familiar with it, I guess...
When you say "the platform" has taken a little bit of a boost do you mean moment.js , or do you mean their is a new API called "relative time format" --
Just read this is part of the Internationalization API which is quite well supported even back to IE 11! now ejecting date-fns !
I do. The web platform. The link is in the description.
why, why, why ! why did you stop recording.... :(
Woah, TIL. www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html#non-null-assertion-operator.
👨🏼💻