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...)
  • НаукаНаука

Комментарии • 59

  • @delulu6969
    @delulu6969 3 года назад

    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

  • @adriandinca5682
    @adriandinca5682 5 лет назад +3

    "I know it exists" always makes chuckle, you deserve a like just for these moments alone. Love your work! :D

    • @aerotwist
      @aerotwist  5 лет назад +1

      Well, sometimes the tech deserves the world's biggest eyeroll

  • @mohamedhussainsh7913
    @mohamedhussainsh7913 5 лет назад +2

    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...

  • @feijldskfhe6891
    @feijldskfhe6891 3 года назад +1

    Where are you man. Missing you and your videos

  • @YinonOved
    @YinonOved 5 лет назад +3

    The difference with innerText and textContent is that innerText gets the text only while textContent will grab style or script tags and their content

    • @aerotwist
      @aerotwist  5 лет назад +1

      Oh yah I forget the details of those two regularly

  • @YinonOved
    @YinonOved 5 лет назад

    :slotted() is valid css and can be used for styling slots. Parentheses can be used to further define the selector of a slot

    • @aerotwist
      @aerotwist  5 лет назад +1

      Yes but often I find it more useful to surround the slot and deal with its parent.

  • @tomasb3191
    @tomasb3191 3 года назад

    just found your channel, great content

  • @ToddSpatafore
    @ToddSpatafore 5 лет назад +3

    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?

    • @aerotwist
      @aerotwist  5 лет назад +4

      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.

  • @abrahamsanchez1205
    @abrahamsanchez1205 5 лет назад

    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...

    • @aerotwist
      @aerotwist  5 лет назад +1

      It's why I do it. None of us need to feel bad about that kind of stuff.

  • @avilde
    @avilde 5 лет назад +1

    Nice and clean code in Github repo ). Pleasant to look at!

  • @zuhairtaha4888
    @zuhairtaha4888 5 лет назад +2

    This channel is on the way to be one of the most famous channels for developers

  • @adamthedev
    @adamthedev 4 года назад

    Great videos, mate. Hope you make some more soon!

  • @mutebg
    @mutebg 5 лет назад +1

    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

  • @TheMagnificientMan
    @TheMagnificientMan 5 лет назад

    Niiiiice ! We need this !!! Hoping it will be released in all major browsers soon

    • @aerotwist
      @aerotwist  5 лет назад

      The repo code has a fallback ;)

  • @SiddharthRay1
    @SiddharthRay1 5 лет назад

    thanks for covering most important aspect in JavaScript 🙏🙏

  • @dassurma
    @dassurma 5 лет назад +3

    Did you just call ISO 8601 _not_ human readable??!

  • @RobertCaka
    @RobertCaka 5 лет назад

    I rly like to watch it! Waiting for the next one :)

  • @ljuglampa
    @ljuglampa 4 года назад +1

    Where did you go?

  • @wilkins7407
    @wilkins7407 5 лет назад

    Paul: "I know it exists"
    Narrator: "But it did not exist"

    • @aerotwist
      @aerotwist  5 лет назад

      😂 "Paul had missed the #"

  • @bahatijustin
    @bahatijustin 5 лет назад

    Well done Paul!

  • @SIRCAM73
    @SIRCAM73 2 года назад

    Subscribed!

  • @juristr
    @juristr 5 лет назад

    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" 😉

    • @aerotwist
      @aerotwist  5 лет назад

      It's from Epidemic Sound :)

    • @juristr
      @juristr 5 лет назад

      @@aerotwist cool, gonna check it out, thx :)

  • @snoopy8870
    @snoopy8870 2 года назад

    what's your vs code theme paul?

  • @eugenenovikov671
    @eugenenovikov671 2 года назад

    спасибо

  • @applePrincess
    @applePrincess 5 лет назад

    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?

    • @aerotwist
      @aerotwist  5 лет назад +4

      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.

  • @deps..
    @deps.. 11 месяцев назад

    Paul senpai, new video pleaaaase 😢

  • @VipulAnand751
    @VipulAnand751 3 года назад

    Where are you Paul?

  • @supriyantapoddar6129
    @supriyantapoddar6129 5 лет назад

    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!

  • @3ombieautopilot
    @3ombieautopilot Месяц назад

    How are you? What’s up?

  • @piotrekwitkowski
    @piotrekwitkowski 5 лет назад

    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!

    • @aerotwist
      @aerotwist  5 лет назад

      It's just a shorthand for TypeScript to tell it that you won't be expecting (and therefore dealing with) a null value

    • @piotrekwitkowski
      @piotrekwitkowski 5 лет назад

      Thanks!

  • @vojtechsebo4119
    @vojtechsebo4119 5 лет назад

    Hi Paul, why don't you use litelement? Thx for vid btw ;)

    • @aerotwist
      @aerotwist  5 лет назад +1

      I could do. Just didn't today. Not everyone is familiar with it, I guess...

  • @rickyu1978
    @rickyu1978 5 лет назад

    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 !

    • @aerotwist
      @aerotwist  5 лет назад

      I do. The web platform. The link is in the description.

  • @robertkaminski1781
    @robertkaminski1781 3 года назад

    why, why, why ! why did you stop recording.... :(

  • @superchillh3o
    @superchillh3o 5 лет назад

    Woah, TIL. www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html#non-null-assertion-operator.

  • @TunaIlgaz
    @TunaIlgaz 5 лет назад

  • @jobybejoy8219
    @jobybejoy8219 5 лет назад

    👨🏼‍💻