Hacker News new | ask | show | jobs
by moron4hire 4353 days ago
Did half of California fall off the continent and sail around the world? San Francisco and NYC have the same time. And why does it take so long for the grey background to change to white?
1 comments

While I see SF in Central European time. Which is my time zone. Which suggests that the clock for SF is using the computer's local time zone instead of the city's time zone, and that you are in the Eastern time zone.

Looking at the code - wow, that's a lot of copy&paste or autogenerated code instead of using a loop. The relevant code is in http://www.pravindaryani.com/officehours/js/main.js :

    //USA/LA Time
    var latime = document.getElementById('la_time');
    var time = moment().tz('America/Los_Angeles');
    latime.innerHTML = time.format('hh:mm A ');

    //USA/SF Time
    var sftime = document.getElementById('sf_time');
    var time = moment().tz('America/San_Francisco');
    sftime.innerHTML = time.format('hh:mm A ');
It's using time zone code from http://momentjs.com/static/js/global.js , and a quick check show that there is no entry for "America/San_Francisco". It looks like the code only applies the correct offset from localtime if the timezone exists, hence why we get different times.
FWIW, it's now fixed.