diff --git a/TODO.md b/TODO.md index a9e8111..6c38ae7 100644 --- a/TODO.md +++ b/TODO.md @@ -25,5 +25,5 @@ - [ ] 라이브 상세 필드 별도 엔드포인트로 노출 - 이닝/카운트/주자/현재 타자·투수는 "스케줄 파악" 목적에서 제외했으나, 라이브 상세 화면 필요 시 `getGameList` 직접 노출하는 별도 핸들러 추가 고려 -- [ ] `formatYmd(new Date())` → `todayKst()` 기반으로 통일 - - 현재 TZ=Asia/Seoul 의존. 환경 변경 시 취약 \ No newline at end of file +- [x] `formatYmd(new Date())` → `todayKst()` 기반으로 통일 + - "오늘" 도출은 TZ 독립 헬퍼(`todayKst`)로 통일 완료. 경기 시간대 시(hour) 게이트는 의도적으로 서버로컬(KST) 유지. \ No newline at end of file diff --git a/src/repositories/kboRepository.ts b/src/repositories/kboRepository.ts index 7c08d35..3c90344 100644 --- a/src/repositories/kboRepository.ts +++ b/src/repositories/kboRepository.ts @@ -28,6 +28,7 @@ import { } from "./kboCacheRepository"; import { firestore } from "../firebase"; import { getGameList } from "../services/gameListService"; +import { todayKst } from "../types/dateString"; import type { GameListRecord } from "../kbo/game-list"; const TTL_MS = 60 * 60 * 1000; // 1 hour @@ -224,7 +225,7 @@ const liveGameListCache = new Map { // 서버 로컬 타임존 기준 "오늘" 날짜. ymd와 비교해 실시간 병합 여부를 결정한다. - const today = formatYmd(new Date()); + const today = todayKst().replace(/-/g, ""); console.log(`[kbo-merge] enter ymd=${ymd} today=${today} games=${games.length}`); // 오늘이 아닌 날짜는 실시간 정보가 의미 없으므로 외부 호출 없이 즉시 반환한다. @@ -456,7 +457,7 @@ async function fetchScheduleMonth( } const games: ScheduleGame[] = []; - const today = formatYmd(new Date()); + const today = todayKst().replace(/-/g, ""); for (const ymd of allDays) { const list = cached.get(dayKey(ymd, filters.team, filters.series)) ?? []; if (ymd === today) {