I'm making a Javascript web application that depends on user's browser time zone.
For example, whenever I check the UTC offset, I find it to be +5.5 only.
How do I test if it works in other time zones as well? I specially want to see how it works with US time zones.
I use Firefox mostly. Is there any configuration setting I can edit? I tried changing my system time zone, but it didn't work.
To change the Chrome time zone for testing, follow the steps below: Open DevTools in Chrome -> Open the Console drawer. Click on the three-dotted menu -> Click on More tools -> Sensors. From the Sensors tab, set the location according to your preference and define the specific timezone.
I would suggest storing all times in UTC format. Perform all your calculations and algorithms with the UTC time. You only care about timezones for display purposes. For a particular user, convert the UTC time to their preferred timezone.
Fortunately, it's easy to change the time zone displayed in Chrome. Click the Customize and Control (wrench) button and select Settings. When the Settings page appears, select the System tab. Go to the Date and Time section, pull down the Time Zone list, and select your current time zone.
You need to restart your browser after you change your system's timezone. Firefox keeps the original timezone, I believe, and Chrome thinks you are in UTC if you do not restart.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With