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
3 views
780
261
6 days ago 00:11:07 20
Puja Tomar vs Shauna Bannon | Highlights | UFC 255 | Strawweight Prelim | 22nd February 2025