From cd53e401869423bfdfa9e6b370b85b6059372d05 Mon Sep 17 00:00:00 2001 From: Ali Hammoud Date: Mon, 30 Nov 2026 23:02:44 +0200 Subject: [PATCH] fix: set AOC timezone to EST --- src/features/advent-of-code/advent-calendar.test.ts | 2 +- src/features/advent-of-code/advent-calendar.ts | 5 ++++- src/features/advent-of-code/advent-scheduler.ts | 9 +++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/features/advent-of-code/advent-calendar.test.ts b/src/features/advent-of-code/advent-calendar.test.ts index 0d6f3bc..e1760d5 100644 --- a/src/features/advent-of-code/advent-calendar.test.ts +++ b/src/features/advent-of-code/advent-calendar.test.ts @@ -89,7 +89,7 @@ void describe('getPostContent', () => { void it('renders a relative Discord timestamp for the event start during the countdown', () => { assert.equal( getPostContent({ year: 2026, day: 1, phase: 'countdown' }), - 'Advent of Code 2026 starts ' + 'Advent of Code 2026 starts ' ); }); diff --git a/src/features/advent-of-code/advent-calendar.ts b/src/features/advent-of-code/advent-calendar.ts index 73a423e..6ecb89f 100644 --- a/src/features/advent-of-code/advent-calendar.ts +++ b/src/features/advent-of-code/advent-calendar.ts @@ -2,6 +2,7 @@ import { time } from 'discord.js'; export const POST_BEFORE_DAYS = 3; export const FINAL_DAY = 12; +export const EVENT_TIME_ZONE = 'EST'; export type AdventPostPhase = 'countdown' | 'open'; @@ -17,7 +18,9 @@ const getEventStartDate = (year: number): Temporal.PlainDate => Temporal.PlainDate.from({ year, month: 12, day: 1 }); const getEventStartInstant = (year: number): Temporal.Instant => - getEventStartDate(year).toZonedDateTime({ timeZone: 'UTC' }).toInstant(); + getEventStartDate(year) + .toZonedDateTime({ timeZone: EVENT_TIME_ZONE }) + .toInstant(); export const getAdventPostStep = ( today: Temporal.PlainDate diff --git a/src/features/advent-of-code/advent-scheduler.ts b/src/features/advent-of-code/advent-scheduler.ts index 8ca358a..3808dc5 100644 --- a/src/features/advent-of-code/advent-scheduler.ts +++ b/src/features/advent-of-code/advent-scheduler.ts @@ -3,6 +3,7 @@ import { SERVER_CHANNELS } from '@/constants/channels.js'; import { prisma } from '@/db/prisma.js'; import { createLogger } from '@/util/logger.js'; import { + EVENT_TIME_ZONE, type AdventPostStep, getAdventPostAction, getAdventPostStep, @@ -57,7 +58,7 @@ const revealFirstDay = async ( }; const runAdventPostCheck = async (): Promise => { - const step = getAdventPostStep(Temporal.Now.plainDateISO('UTC')); + const step = getAdventPostStep(Temporal.Now.plainDateISO(EVENT_TIME_ZONE)); if (step === null) { return; @@ -86,7 +87,7 @@ const runScheduledAdventPostCheck = (): void => { /** * Posts a countdown to the event start, edits it into the day 1 link when the - * event opens, and posts each following day at midnight UTC. + * event opens, and posts each following day at midnight EST. */ export function initializeAdventScheduler(): void { logger.info('🎄 Initializing Advent of Code scheduler...'); @@ -94,10 +95,10 @@ export function initializeAdventScheduler(): void { runScheduledAdventPostCheck(); cron.schedule('0 0 * * *', runScheduledAdventPostCheck, { - timezone: 'UTC', + timezone: EVENT_TIME_ZONE, }); logger.info( - '✅ Advent of Code scheduler initialized (runs daily at midnight UTC)' + '✅ Advent of Code scheduler initialized (runs daily at midnight EST)' ); }