Night & Day Mode with and TailwindCSS

In this video, I will show you how you can detect the user’s time convert it to hours, and then see if its morning or night. I base it on 6am - 6pm this is not the most accurate but gives you an idea of a starting point. You may want to use something like moment js or moment timezone js for a more accurate timezone. I also use Alpine js in the video and tailwind CSS to give it some binding and some style. Both are overkill for something like this but I almost always have them in my projects. CodePen Alpine
Back to Top