Hacker News new | ask | show | jobs
Show HN: Is country X in its office hours (9am to 5pm)? (pravindaryani.com)
2 points by boy88 4353 days ago
3 comments

Bug report: all cities appear as black text on a white background, regardless of the local time. Safari on iOS.
I would correct 'Nertherlands' or make it 'Nerdylands' altogether. ;)
heheh thanks for pointing that out, typo fixed
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?
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.