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.

kapeels
  • 1,692
  • 4
  • 30
  • 52

2 Answers2

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.

Ben Belchak
  • 549
  • 3
  • 6
  • 4
    ...or simply open another instance of FF or Chrome if (like me) you're a tab hoarder :-) – Stig Perez Mar 25 '14 at 09:59
  • 4
    In Chrome at least, I don't need to restart the browser. Simply close the tab and then reopen it. – Doug S May 14 '14 at 21:20
  • I'm on Ubuntu, simple (F5) refresh worked for me in Chrome. – Ev Dolzhenko Feb 17 '16 at 14:36
  • 7
    Is there anything we can do with Developer Tools on Chrome to spoof System Timezone? – Ravi Dhoriya ツ Feb 25 '16 at 17:07
  • @RaviDhoriya , **Yes** definitely. Is there a way to set **arbitrary** timezones? For example **+15:00** (which doesn't exist since [14 is max](https://en.wikipedia.org/wiki/UTC%2B14:00)) and "subdecimals" like **+08:12:04.3384**. This would be useful to do "ease testing". – Pacerier Apr 09 '16 at 14:13
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!

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
facundofarias
  • 2,973
  • 28
  • 27