Streaming live at 10am (PST)

How to change the theme of the website on the basis of timezone?

Hello Guys,

So I have added a toggle button on the website and it changes the theme when clicked on it. I wanted to know how to do it on the basis of the timezone. So, At night it automatically gets switched to the dark mode. How can we do that?

Regards,
Sagar Arora


Here is my site Read-Only: Webflow - Ez-infra

If you need to determine the user’s current time zone you need a database of them you can use in code. Fortunately there is a great utility called day.js that has one and makes working with time and dates easy. It’s on GitHub.

Hey @webdev,
Thank you for the reply. I will surely try it out and let you know.

Regards,
Sagar Arora