Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

What is a simple way to temporarily change the timezone in Chrome so as to test how a site renders for different locations?

On OSX Mountain Lion, I've tried as bash script with:

export TZ='Indian/Mauritius'

date
open /Applications/Google\ Chrome.app ~/status.html

where status.html * contains

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Time zone test</title>
</head>
<div id="local"></div>
<div id="offset"></div>
<script>
    document.getElementById('local').innerHTML = "The local time is " + (new Date()).toLocaleString();
    document.getElementById('offset').innerHTML = "Local offset:" + (new Date()).getTimezoneOffset();
</script>
</body> 
</html>

The date command correctly returns Mauritius time, but the javascript renders the time as being my machine's time

* apologies for posting the whole file, but there might be relevant tags I haven't considered

share|improve this question

2 Answers 2

Turns out one needs to kill all existing Chrome processes first.

export TZ='Indian/Mauritius'

killall Chrome
date
open /Applications/Google\ Chrome.app ~/status.html
share|improve this answer

Well the easiest method would be just to change the time on your local machine, I'm sure you know how to do this already but: OS X Mountain Lion: Date & Time preferences.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.