

Show HN: Is country X in its office hours (9am to 5pm)? - boy88
http://www.pravindaryani.com/officehours/

======
mooism2
Bug report: all cities appear as black text on a white background, regardless
of the local time. Safari on iOS.

------
the_ed
I would correct 'Nertherlands' or make it 'Nerdylands' altogether. ;)

~~~
boy88
heheh thanks for pointing that out, typo fixed

------
moron4hire
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?

~~~
dalke
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](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](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.

~~~
dalke
FWIW, it's now fixed.

