Derive today via todayKst in kboRepository
- mergeLiveIntoSchedule·fetchScheduleMonth의 formatYmd(new Date())를 todayKst().replace로 교체 — 서버 TZ 의존 제거, 정규 KST 헬퍼로 통일 - 명시적 날짜용 formatYmd와 경기 시간대 시(hour) 게이트는 그대로 유지 - TODO.md 해당 항목 종결
This commit is contained in:
parent
6d78ef5c7a
commit
526a8ef731
4
TODO.md
4
TODO.md
@ -25,5 +25,5 @@
|
||||
|
||||
- [ ] 라이브 상세 필드 별도 엔드포인트로 노출
|
||||
- 이닝/카운트/주자/현재 타자·투수는 "스케줄 파악" 목적에서 제외했으나, 라이브 상세 화면 필요 시 `getGameList` 직접 노출하는 별도 핸들러 추가 고려
|
||||
- [ ] `formatYmd(new Date())` → `todayKst()` 기반으로 통일
|
||||
- 현재 TZ=Asia/Seoul 의존. 환경 변경 시 취약
|
||||
- [x] `formatYmd(new Date())` → `todayKst()` 기반으로 통일
|
||||
- "오늘" 도출은 TZ 독립 헬퍼(`todayKst`)로 통일 완료. 경기 시간대 시(hour) 게이트는 의도적으로 서버로컬(KST) 유지.
|
||||
@ -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<string, { at: number; games: GameListRecord[]
|
||||
* "예정" 또는 "종료"로 고정이라 라이브 fetch가 매번 같은 값을 돌려준다. 자정 넘긴
|
||||
* 연장 경기는 날짜(ymd)가 어제로 남아 상위의 `ymd !== today` 분기에서 이미 걸러진다.
|
||||
*/
|
||||
// 서버 로컬시간 = KST(.env의 TZ=Asia/Seoul). 위의 formatYmd(new Date())와 동일 기준.
|
||||
// 경기 시간대 게이트는 시(hour) 단위라 서버 로컬시간(=KST, .env TZ=Asia/Seoul)으로 충분.
|
||||
const KST_GAME_WINDOW_START_HOUR = 14;
|
||||
|
||||
async function getLiveGameListCached(
|
||||
@ -249,7 +250,7 @@ async function mergeLiveIntoSchedule(
|
||||
series: string | undefined
|
||||
): Promise<ScheduleGame[]> {
|
||||
// 서버 로컬 타임존 기준 "오늘" 날짜. 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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user