2 points · by boy88 · 12y ago · 6 comments
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.