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: https://preview.webflow.com/preview/ez-infra-164004?utm_medium=preview_link&utm_source=designer&utm_content=ez-infra-164004&preview=6c5c48af9082a260ddf732f12b6fa9e5&mode=preview

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