INNER CODE UNIT · JavaScript
day
dearvn/tradovate-trading-bot · agents/order-flow/index.js:45
const day = d.getUTCDay(); // 0=Sun
d.setUTCDate(1 + ((7 - day) % 7) + (n - 1) * 7);
return d;
}
function etOffsetHours(now) {
const y = now.getUTCFullYear();
// EDT: 2nd Sunday March 02:00 → 4th Sunday November 02:00
const dstStart = nthSundayUTC(y, 2, 2); // March (month 2)
dstStart.setUTCHours(7); // 02:00 ET = 07:00 UTC
const dstEnd = nthSundayUTC(y, 10, 1); // November (month 10), 1st Sunday
dstEnd.setUTCHours(6); // 02:00 ET = 06:00 UTC
return now >= dstStart && now < dstEnd ? -4 : -5;
}
function nowET() {
const now = new Date();
const off = etOffsetHours(now);