Skip to content

fix: 날짜 표시·필터를 KST 기준 공통 유틸로 일원화함#28

Merged
umsungjun merged 1 commit into
mainfrom
fix/kst-date-format
Jun 22, 2026
Merged

fix: 날짜 표시·필터를 KST 기준 공통 유틸로 일원화함#28
umsungjun merged 1 commit into
mainfrom
fix/kst-date-format

Conversation

@umsungjun

@umsungjun umsungjun commented Jun 22, 2026

Copy link
Copy Markdown
Owner

toLocaleDateString/toISOString().split를 직접 호출하던 곳들이 timeZone 미지정이라 Vercel 서버리스(UTC) 기준으로 동작 → KST 자정~오전 9시 갱신 시 날짜가 하루 어긋나던 문제 수정함.

  • src/lib/date-utils.ts 신설: formatKstLongDate/formatEventDate/formatKstDate/getKstTodayStr (timeZone Asia/Seoul 고정)
  • 표시 날짜 7곳·예정 이벤트 "오늘" 필터 4곳(컴포넌트 2 + 크롤러 2)을 공통 유틸 경유로 전환함
  • 저장용 타임스탬프(crawledAt/updatedAt/generatedAt)는 UTC toISOString 유지 — 표시 시점에만 KST 변환
  • CLAUDE.md에 날짜 포맷 컨벤션 추가해 재발 방지함

Summary by CodeRabbit

릴리스 노트

  • 개선 사항
    • 애플리케이션 전반의 날짜 표시가 한국 표준시(KST) 기준으로 통일되었습니다. 사용자 기기의 시간대 설정과 관계없이 일관된 날짜를 확인할 수 있습니다.
    • 일정 필터링 시 "오늘 이후" 기준이 정확하게 작동합니다.

toLocaleDateString/toISOString().split를 직접 호출하던 곳들이 timeZone 미지정이라 Vercel 서버리스(UTC) 기준으로 동작 → KST 자정~오전 9시 갱신 시 날짜가 하루 어긋나던 문제 수정함.

- src/lib/date-utils.ts 신설: formatKstLongDate/formatEventDate/formatKstDate/getKstTodayStr (timeZone Asia/Seoul 고정)
- 표시 날짜 7곳·예정 이벤트 "오늘" 필터 4곳(컴포넌트 2 + 크롤러 2)을 공통 유틸 경유로 전환함
- 저장용 타임스탬프(crawledAt/updatedAt/generatedAt)는 UTC toISOString 유지 — 표시 시점에만 KST 변환
- CLAUDE.md에 날짜 포맷 컨벤션 추가해 재발 방지함
Copilot AI review requested due to automatic review settings June 22, 2026 00:47
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lets-ko Ready Ready Preview, Comment Jun 22, 2026 12:47am

@umsungjun umsungjun merged commit c28a3ab into main Jun 22, 2026
3 of 4 checks passed
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: fb842272-7f40-486e-aef9-68f7b5513f44

📥 Commits

Reviewing files that changed from the base of the PR and between 63f7c6c and 2feed6a.

📒 Files selected for processing (10)
  • CLAUDE.md
  • src/components/fighter/PredictionPreview.tsx
  • src/components/fighter/VideoSection.tsx
  • src/components/predictions/PredictionDetail.tsx
  • src/components/schedule/EventCard.tsx
  • src/components/schedule/SchedulePreview.tsx
  • src/components/schedule/ScheduleView.tsx
  • src/components/youtube/VideoCard.tsx
  • src/lib/crawl/schedule-crawler.ts
  • src/lib/date-utils.ts

📝 Walkthrough

Walkthrough

src/lib/date-utils.ts에 KST(Asia/Seoul) 기준 날짜 포맷 및 "오늘" 문자열 유틸 4개(formatKstDate, formatKstLongDate, formatEventDate, getKstTodayStr)를 신규 추가하고, 스케줄·파이터·유튜브 컴포넌트 7개와 크롤러에서 toLocaleDateString/toISOString().split 직접 호출을 해당 유틸로 일괄 교체한다. CLAUDE.md에 관련 사용 지침도 추가된다.

Changes

KST 날짜 유틸리티 추가 및 일괄 적용

Layer / File(s) Summary
date-utils.ts 유틸 함수 신규 구현
src/lib/date-utils.ts
toIntlLocale 헬퍼, formatKstDate, formatKstLongDate, formatEventDate, getKstTodayStr 총 4개 공개 함수를 신규 추가한다. formatEventDate는 날짜 드리프트 방지를 위해 T12:00:00+09:00 KST 정오 앵커링을 사용하고, getKstTodayStren-CA 로케일로 YYYY-MM-DD 형태를 반환한다.
스케줄 컴포넌트 교체
src/components/schedule/ScheduleView.tsx, src/components/schedule/SchedulePreview.tsx, src/components/schedule/EventCard.tsx
ScheduleViewupdatedDate와 이벤트 필터 today, SchedulePreviewtodayformattedDate, EventCardformattedDate 계산을 각각 formatKstLongDate/getKstTodayStr/formatEventDate로 교체한다.
파이터·예측·유튜브 컴포넌트 교체
src/components/fighter/PredictionPreview.tsx, src/components/predictions/PredictionDetail.tsx, src/components/fighter/VideoSection.tsx, src/components/youtube/VideoCard.tsx
예측 생성일 표시(formatKstLongDate), 유튜브 게시일 표시(formatKstDate)로 교체한다. VideoCard에서는 dateLocale 변수 선택 로직도 함께 제거된다.
크롤러 today 기준 교체 및 CLAUDE.md 지침 추가
src/lib/crawl/schedule-crawler.ts, CLAUDE.md
CloudFront·HTML 파싱 두 경로의 today 값을 getKstTodayStr()로 교체하고, CLAUDE.mdtoLocaleDateString/toISOString().split 직접 호출 금지 지침을 추가한다.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 날짜를 직접 쪼개던 시절은 지났어요,
KST 정오 닻을 내리고 통일했죠.
toISOString().split은 이제 안녕~
getKstTodayStr()가 오늘을 알려줘요!
서울 시간 기준, 날짜도 깔끔 🌸

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/kst-date-format

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Vercel 서버리스(UTC) 환경에서 timeZone 미지정으로 인해 KST 기준 날짜가 하루씩 어긋나던 문제를 해결하기 위해, 표시/필터용 날짜 처리를 KST 고정 공통 유틸(src/lib/date-utils.ts)로 일원화한 PR입니다.

Changes:

  • formatKstDate/formatKstLongDate/formatEventDate/getKstTodayStr 유틸을 신설해 KST 기준 포맷을 중앙집중화
  • 화면 표시(YouTube/예측/스케줄) 및 “오늘 이후 이벤트” 필터 로직을 공통 유틸 사용으로 교체
  • 날짜 포맷 컨벤션을 CLAUDE.md에 명문화하여 재발 방지

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/lib/date-utils.ts KST 기준 날짜 포맷/“오늘” 문자열 생성 유틸 추가
src/lib/crawl/schedule-crawler.ts 이벤트 “오늘” 필터 기준을 KST 유틸로 교체
src/components/youtube/VideoCard.tsx 영상 게시일 표시를 KST 유틸로 교체
src/components/schedule/ScheduleView.tsx 업데이트 날짜 표시 및 “오늘” 필터를 KST 유틸로 교체
src/components/schedule/SchedulePreview.tsx “오늘 이후 이벤트” 및 이벤트 날짜 표시를 KST 유틸로 교체
src/components/schedule/EventCard.tsx 이벤트 날짜 표시를 KST 유틸로 교체
src/components/predictions/PredictionDetail.tsx 생성일 표시를 KST 유틸로 교체
src/components/fighter/VideoSection.tsx 영상 게시일 표시를 KST 유틸로 교체
src/components/fighter/PredictionPreview.tsx 생성일 표시를 KST 유틸로 교체
CLAUDE.md 날짜 포맷/필터 컨벤션 추가

Comment thread src/lib/date-utils.ts
Comment on lines +54 to +61
/**
* @description 현재 시각을 KST 기준 "YYYY-MM-DD" 문자열로 반환 (예정 이벤트 필터의 "오늘" 비교용).
* 기존 `new Date().toISOString().split("T")[0]`는 UTC 날짜라 KST 자정~오전 9시 구간에 하루 어긋남.
* en-CA 로케일은 "YYYY-MM-DD" 출력을 보장하므로 event.date 문자열 비교에 그대로 사용 가능.
* @returns KST 기준 "YYYY-MM-DD"
*/
export const getKstTodayStr = (): string =>
new Date().toLocaleDateString("en-CA", { timeZone: "Asia/Seoul" });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants