From 526a8ef7316e20a1077864d1ac1f4efa1ec4de72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9C=A4=EC=A0=95=EB=AF=BC?= Date: Sat, 27 Jun 2026 00:20:44 +0900 Subject: [PATCH] Derive today via todayKst in kboRepository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - mergeLiveIntoSchedule·fetchScheduleMonth의 formatYmd(new Date())를 todayKst().replace로 교체 — 서버 TZ 의존 제거, 정규 KST 헬퍼로 통일 - 명시적 날짜용 formatYmd와 경기 시간대 시(hour) 게이트는 그대로 유지 - TODO.md 해당 항목 종결 --- TODO.md | 4 ++-- src/repositories/kboRepository.ts | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) 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) {