I need to offset the time by an hour if it's currently DST in the Pacific Time Zone. How can I determine the current daylight savings status of the Pacific Time Zone, regardless of the user's local timezone?
Here's what I have so far. "dst" in line 4 is just a placeholder for a function that would tell me if daylight savings time is active in that zone.
function checkTime() {
var d = new Date();
var hour = d.getUTCHours();
var offset = dst ? 7 : 8; // is pacific time currently in daylight savings?
// is it currently 6 AM, 2 PM, or 10 PM?
if (hour === ((6 + offset) % 24) || hour === ((14 + offset) % 24) || hour === ((22 + offset) % 24)) {
// do stuff
}
}
checkTime();