: Test different timezones 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
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
More posts by @Sue5673885
2 Comments
Sorted by latest first Latest Oldest Best
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
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.