Building an Interactive Calendar with Tailwind UI, React and date-fns

Поделиться
HTML-код
  • Опубликовано: 12 май 2022
  • Let's take a predesigned calendar from Tailwind UI and make it functional using React and the fantastic date-fns library!
    💻 Calendar demo: stackblitz.com/github/samseli...
    🧑‍💻 Diff from this video: github.com/samselikoff/2022-0...
    ✨ Tailwind UI Calendars: tailwindui.com/components/app...
    📆 date-fns library: date-fns.org
  • РазвлеченияРазвлечения

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

  • @waldolavaut2800
    @waldolavaut2800 Год назад +13

    This is a master class!! I still can't believe I was looking for this exact implementation of how to do this with TailwindUI, date-fns, and React, and I'm so lucky to find this awesome video!! You're the man!

  • @MattChinander
    @MattChinander 2 года назад +2

    This is great, Sam. Thank you for posting this video. I have a Tailwind-backed project coming up where I've wanted to replace a calendar library with Tailwind and date-fns, and you've done the work for me!

  • @liamsmith6859
    @liamsmith6859 8 месяцев назад +1

    Sam, this is freaking awesome - thanks so much for putting this together. So cool seeing you pull this together and how you approach it.

  • @AlexSmith-sf9qr
    @AlexSmith-sf9qr 2 года назад +1

    Loving these focused videos, nice work!

  • @saurabhdaswant7833
    @saurabhdaswant7833 Год назад

    man! just 10 min into the video and loved the way you teach and how date-fns beautifully works like a magic

  • @ivantotev9343
    @ivantotev9343 Год назад

    Great video, Sam ! Really helped me understand date fns !

  • @HeyNoah
    @HeyNoah 2 года назад +1

    Dude.. this was great!!! Thank you so much, love your vids!!!

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

    Another Fantastic tutorial Sam! My version came together beautifully. Thx! again.

  • @adamtak3128
    @adamtak3128 2 года назад +2

    Best dev channel. Always come out with banger content!

  • @techspace5373
    @techspace5373 Год назад

    These videos are just so interesting and fun to watch!

  • @khairulhaaziq2332
    @khairulhaaziq2332 Год назад

    Best tutorial ever. Went from not knowing anything about calendars now I can make a library

  • @stevecastaneda
    @stevecastaneda 2 года назад +16

    I've been meaning to migate from momentjs, and you just got me excited about date-fns. Love the integration with the new TailwindUI calendar example too. Would love to see a follow up video with the framer animations. 🙏

    • @sanketss84
      @sanketss84 Год назад +1

      a vote for framer animations

  • @varsketisLT
    @varsketisLT Год назад

    just used it in my first ever full-stack project! Will try to improve and tweak it a a bit, but still, thank you so much! Subbed

  • @robinvriens
    @robinvriens Год назад

    What a great explanation, everything was very clear!

  • @Apparentt
    @Apparentt 2 года назад +16

    Think you hit it on the head when you said after using date fns for a while you could kinda just “guess” the API - that’s the sign of a fantastic library

  • @tutoriaisdev
    @tutoriaisdev Год назад

    Amazing video, thank you Sam!!

  • @MachetesTV
    @MachetesTV Год назад

    Thanks very much for this Video, i created a simillary calendar with angular, it was a pleasure beeing guided by you!

  • @yvigg
    @yvigg 4 месяца назад

    This is so cool. Thanks mate. You really saved me!

  • @nazarshvets7501
    @nazarshvets7501 Год назад

    Wow! I`m speachless. Great content 🔥🔥🔥

  • @AlanMontgomery
    @AlanMontgomery Год назад

    Hey Sam. Beautiful tutorial!

  • @joshuastories
    @joshuastories Год назад

    This is really cool. Thank you very very much!

  • @paulikhane
    @paulikhane 7 месяцев назад

    Masterfully done!!!

  • @IamGroot701
    @IamGroot701 Год назад

    This is great! Thanks for sharing!

  • @nonsookongwu1556
    @nonsookongwu1556 Месяц назад

    Bro, you solved my problem. Thanks so much for this tutorial

  • @sethdavis512
    @sethdavis512 Год назад

    Great video - thanks for sharing!

  • @joshuapadron-uy9513
    @joshuapadron-uy9513 Год назад

    Awesome Tutorial!! :D 10/10

  • @bobdpa
    @bobdpa Год назад

    Wow awesome video! Thanks!

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

    Just what I need now. Thanks

  • @althafabbas5385
    @althafabbas5385 7 месяцев назад

    wow, great vdo broii, thanks

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

    great video ✨

  • @LuksFay
    @LuksFay Год назад

    AMAZING. Seens like will be very usefull for my project, so thanks u for share this!

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

    Thanks for this great video

  • @sunil.b
    @sunil.b 2 года назад

    Great Sir!👏

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

    Excellent , thank you 👍

  • @garyg3327
    @garyg3327 Год назад

    I remember about 9 years ago when I started working professionally, I was stunned my work mate was paying for a components library. These UI components are still paid for for premium ones.

  • @vfshera
    @vfshera Год назад

    Exactly what I am looking for

  • @rhidlor8577
    @rhidlor8577 2 года назад +1

    very nice, thank you

  • @kariza76record
    @kariza76record 4 месяца назад

    Awesome 🎉🎉

  • @alihossemedine62
    @alihossemedine62 Год назад

    great stuff

  • @simonswiss
    @simonswiss 2 года назад +14

    I may be missing something, but I _think_ that using `startOfWeek(firstDayOfMonth)` works well for the start of the days range for a given month - lets you skip calculating the grid col-start offset based on what weekday the month starts on.
    That's how I've done it a few days ago, and it seems to work quite well.
    I start my weeks on Monday, so I have this:
    ```
    const daysOfTheMonth = eachDayOfInterval({
    start: startOfWeek(firstDayOfMonth, { weekStartsOn: 1 }),
    end: endOfWeek(endOfMonth(firstDayOfMonth), { weekStartsOn: 1 }),
    })
    ```

    • @simonswiss
      @simonswiss 2 года назад +5

      Heh, of course 1 minute after writing this comment I see you show that exact thing 😅 Awesome video man.

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

    Nice video!! u have a new member

  • @treforcoster3377
    @treforcoster3377 Год назад

    Love this video. I have a question though how would you deal with two events at the same time on a css grid calendar?

  • @djimenezweb
    @djimenezweb 9 месяцев назад

    Loved it, thank you Sam!
    I wonder if it could be refactored to Styled Components. I've tried to refactor the button styles, but there are too many conditions to check. Any ideas?

  • @avinashgardasalgonquin4371
    @avinashgardasalgonquin4371 10 месяцев назад

    wow amazing!

  • @user-ej4iv4ry3w
    @user-ej4iv4ry3w 3 месяца назад

    Great video Sam. What calendar backend or server are you using? Hopefully it has APIs that I can call from my React app to actually persist the events.

  • @faruksardar8829
    @faruksardar8829 5 месяцев назад

    You are Amazing 💥🔥

  • @salzpro
    @salzpro Год назад +1

    Thank you for very useful understandable learning Video, Sam! Would it be possible to extend functionality like: 1) to show 2 months and 2 buttons (next, prev) will switch also 2 months. 2) possibility to select a date range

  • @alexg7282
    @alexg7282 Год назад

    Thank you!

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

    Most underrated youtuber! Sorry for asking again but when are you getting a community discord so we can interact with you? :D

  • @sallehshah
    @sallehshah 8 месяцев назад

    love your content ♥♥♥♥♥♥

  • @julietkelechi7785
    @julietkelechi7785 Год назад

    Cool video, how do you reduce the height of the calendar?

  • @raskolnikov1873
    @raskolnikov1873 Год назад

    This was great! What do I do if I want to show all the events that are scheduled for the month instead of just the selected day? I can't get that to work.

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

    Another neat video would be doing all this with remix and server side rendering: and lifting state to the route :)

  • @sashaikevich
    @sashaikevich Год назад

    How do you decide on the library to use? For eg why date-fns and not moments or dayjs or spend half a day looking for some other lightweight performant library?

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

    Thank you.

  • @kobbimensah547
    @kobbimensah547 Год назад

    Wow thanks a lot

  • @engelshentenawy
    @engelshentenawy Год назад

    Thanks.

  • @enochasandahall2034
    @enochasandahall2034 Год назад

    it's really nice, especially the music in the background, can you tell me the music playlist

  • @bublikbublikovich2229
    @bublikbublikovich2229 Год назад

    which command did you use to install tailwind? i tried npm install tailwindcss@latest, but styles didn't work

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

    What if I want to select a period of days? For example, I want to see all meeting from May 22 until May 29, how would I do that?

  • @sandrahufford8858
    @sandrahufford8858 Год назад +1

    This is the help I've been looking for! Thanks for concise coding. However, trying to convert it to Vue composition API and I got stuck at let firstDayCurrentMonth = parse(currentMonth, 'MMM-yyyy', new Date()) I keep getting invalid date. Any suggestions?

    • @dev-mantas
      @dev-mantas Год назад +1

      This is telling date-fns how the date is read, for example if you are displaying your date as Oct, 2022 it should be firstDayCurrentMonth = parse(currentMonth, 'MMM, yyyy', new Date())

    • @dev-mantas
      @dev-mantas Год назад +1

      Make sure 'MMM-yyyy' is the same format as currentMonth

  • @UncleDavid
    @UncleDavid Год назад

    can i steal this for a pythononic version and turn it into work schedule thingy?

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

    what shortcut do u use to collapse sections or tags ?

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

      z then c to close or o to open

  • @prashank
    @prashank 2 года назад +1

    What a coincidence, I was working on a renderless calendar but for vue just a week ago. I did all the date calculations with js date objects, that sucked. Would have used date-fns if i knew about it, most of date library are bloated with spotty tree shaking.

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

    m very new to tail wind css, i have a question do you use it everysingle time or only for selective projects?
    Thanks

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

      I use it on every project! And try to get every team we consult with to switch to it if they're not using it already :)

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

      @@samselikoff ah thanks for clearing the confusion ! for some weird reason youtube didnt notify me about your reply.

  • @SeanCassiere
    @SeanCassiere Год назад

    Could we get a follow-up to this?

  • @wfl-junior
    @wfl-junior Год назад

    Do you have a video for the animated version?

    • @samselikoff
      @samselikoff  Год назад +1

      Yes, it's actually part of the course I launched! buildui.com/series/framer-motion-recipes/calendar

  • @ramnavan
    @ramnavan 9 месяцев назад

    Probably isSameDay should be used instead of isEqual? isEqual compares time compoent as well which caused problems when UTC and local are in different dates.

  • @SogMosee
    @SogMosee Год назад

    Make an infinitely scrolling calendar like on todoist

  • @jimshtepa5423
    @jimshtepa5423 Год назад

    why is May 1 falls on Sunday when it should be on Monday in 2023? when I repeat what Sam did in this video I get May 1 on Monday and that is how it is in real calendar

    • @samselikoff
      @samselikoff  Год назад

      Sounds like a time zone issue...

  • @eshw23
    @eshw23 Год назад +2

    I was loving everything until you said we have to pay hundreds of dollars for the components to follow this video.

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

    I don't like it, you could build it from scratch, vanilla js have everything you need to achieve this, that's not really programming..

    • @SamedGaming
      @SamedGaming 2 года назад +9

      I hope you are being sarcastic, since this is built from scratch

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

      @@SamedGaming Vanilla is when you don't use external library. He's using date-fns.

  • @Housni.Benabid
    @Housni.Benabid Год назад +1

    This is amazing brother. I suggest to you the following. Instead of refactoring the tailwind UI components with the date-fns conditions. I think better to map the returned array from eachDayOfInterval to make it look the same as the given JSON object from tailwind. example : hosnyben.me/date-fns.png