How do I test my browser timezone dependent application againts different timezones? [duplicate]
Asked Answered
S

2

25

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.

Styria answered 12/2, 2011 at 6:27 Comment(2)
On Firefox 45.0.1 + Windows 7, changing system timezone and refreshing works (at everytimezone.com for example).Angeliqueangelis
@S.Kirby, A refresh will work.Cobble
F
17

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.

Foreordination answered 12/2, 2011 at 6:51 Comment(5)
...or simply open another instance of FF or Chrome if (like me) you're a tab hoarder :-)Alleged
In Chrome at least, I don't need to restart the browser. Simply close the tab and then reopen it.Specialism
I'm on Ubuntu, simple (F5) refresh worked for me in Chrome.Gegenschein
Is there anything we can do with Developer Tools on Chrome to spoof System Timezone?Eurythmic
@RaviDhoriya , Yes definitely. Is there a way to set arbitrary timezones? For example +15:00 (which doesn't exist since 14 is max) and "subdecimals" like +08:12:04.3384. This would be useful to do "ease testing".Cobble
B
8

In this regard, I've used this script on OS X: fresh-chrome-with-custom-tz.sh

The script starts an instance of Chrome with its own environment. To configure it to use a specific timezone, edit this in the script:

# Change this to the spoof a different timezone. Helpful for testing timezone specific client facing content.
export TZ="America/Los_Angeles"

It relies on the TZ environment variable. Works like a charm!

Beastly answered 13/10, 2016 at 12:33 Comment(2)
Great solution!Lupus
Made my life a lot easier!Rutherfurd

© 2022 - 2024 — McMap. All rights reserved.