Datetime is such a fundamental thing in programming. For a restaurant site I made I had to make a modal that showed if they were open or not and it seemed simple at first but it was actually quite a puzzle. Things like this make it easier, so thnx! :)
Since I just make one major video a week, I’ll probably mix it up more, but there are so many browser APIs that remove the need for libraries people still use. I’d like to keep going on these types of videos :)
Have you tried this in Astro with markdown files using SSG? When it builds, it's a day off due to the whole timezone issue. When setting the timezone to UTC, it works, but I'm unsure when building this on Netlify, where the timezone may be different, this will return the right date.
You can set the time zone and netlify will respect it. So if you take your date object and do the following… date.toLocaleString("en-US", {timeZone: "America/New_York"}));
Datetime is such a fundamental thing in programming. For a restaurant site I made I had to make a modal that showed if they were open or not and it seemed simple at first but it was actually quite a puzzle. Things like this make it easier, so thnx! :)
Agreed! I am really excited for the temporal API! It’ll make date/time math much easier, too! Hoping to explore it soon!
Thanks for sharing Chris 🙏. Now no need of using packages to format dates in JavaScript. And it is easy to implement.
Glad it was a help! Yep! And especially once the temporal API is really up and running, most won't need date libraries any more!
@@CodinginPublic Yes, thank you.
I think we can use narrow weekday in calendar
Neat. Knew about this, but not the alternate calendars.
Me neither until I started looking into it!
Thanks for the video, I always struggle with JS dates :D do you have any video about adding/removing days? or for that you recommend a library?
Date fns is good! There’s a new temporal api in js for dealing with dates that can also do that. Glad you enjoyed the video!
Interesting topic.
Suggestion - You can make a series on different APIs weekly.
Since I just make one major video a week, I’ll probably mix it up more, but there are so many browser APIs that remove the need for libraries people still use. I’d like to keep going on these types of videos :)
@@CodinginPublic okay
Have you tried this in Astro with markdown files using SSG? When it builds, it's a day off due to the whole timezone issue. When setting the timezone to UTC, it works, but I'm unsure when building this on Netlify, where the timezone may be different, this will return the right date.
You can set the time zone and netlify will respect it. So if you take your date object and do the following…
date.toLocaleString("en-US", {timeZone: "America/New_York"}));
Great bro 👌
Glad you enjoyed it!
@@CodinginPublic React too...
🙌
Cool. What is your theme and font used in this vid?
Glad you enjoyed it. Cascadia Code and Monokai Pro (vid here: ruclips.net/video/5uETTXxVj8s/видео.html)
First again, pog!
🙌