Skip to content

[fit/mat-239] NotificationItem time formatDate 기능 수정#286

Open
b0nsu wants to merge 2 commits intodevelopfrom
fix/mat-239-notification-time-format
Open

[fit/mat-239] NotificationItem time formatDate 기능 수정#286
b0nsu wants to merge 2 commits intodevelopfrom
fix/mat-239-notification-time-format

Conversation

@b0nsu
Copy link
Copy Markdown
Collaborator

@b0nsu b0nsu commented Apr 18, 2026

Show only date (M월 D일) instead of time when dateString lacks HH:MM pattern, even for today's notifications

Summary

알림/공지사항 목록에서 서버 응답에 시간 정보(HH:MM)가 없는 경우에도 오늘 00:00으로 표시되던 문제 수정. dateString에 시/분 패턴이
포함된 경우에만 시간을 표시하고, 없으면 날짜만 표시하도록 변경.

Linear

MAT-239: NotificationItem time formatDate 기능 수정 / ci

Changes

  • formatDate에 hasTime 체크 추가 — dateString에 HH:MM 패턴이 없으면 오늘이어도 날짜만 표시
  • NotificationsScreen.tsx, NoticeScreen.tsx 두 파일 동일 적용

Testing

  • 시간 포함 ("2026-04-18T14:30:00") + 오늘 → 오늘 14:30 표시 확인
  • 시간 미포함 ("2026-04-18") + 오늘 → 4월 18일 표시 확인
  • 과거 날짜 → 기존과 동일하게 M월 D일 표시 확인

Risk / Impact

  • 영향 범위: 학생 알림 목록, 공지사항 목록의 날짜 표시
  • 확인이 필요한 부분: API 응답의 startAt / 날짜 필드가 실제로 시간 없이 내려오는 케이스가 있는지
  • 배포 시 유의사항:

Screenshots / Video

스크린샷 2026-04-18 오전 10 45 41

Show only date (M월 D일) instead of time when dateString lacks HH:MM pattern, even for today's notifications

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear bot commented Apr 18, 2026

@b0nsu b0nsu requested review from Copilot and sterdsterd and removed request for sterdsterd April 18, 2026 01:53
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 18, 2026

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

Project Deployment Actions Updated (UTC)
pointer-admin Ready Ready Preview, Comment Apr 18, 2026 4:41am

@b0nsu b0nsu requested a review from sterdsterd April 18, 2026 01:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates notification/notice date labeling so that when the backend date string does not include a time (HH:MM), the UI shows only the date (M월 D일) even if it is today.

Changes:

  • Added a hasTime check (/\d{2}:\d{2}/) to formatDate to gate “오늘 HH:MM” formatting.
  • Applied the same formatting behavior to both the notice list and the notifications screen.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
apps/native/src/features/student/menu/screens/NoticeScreen.tsx Adjusts formatDate to avoid showing time for date-only strings.
apps/native/src/features/student/home/screens/notifications/NotificationsScreen.tsx Applies the same formatDate change for both notices and notifications.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +13 to +15
const date = new Date(dateString);
const now = new Date();
const hasTime = /\d{2}:\d{2}/.test(dateString);
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

dateStringYYYY-MM-DD(time 미포함) 형태일 때 new Date(dateString)는 UTC 기준으로 파싱되어 로컬 타임존에 따라 날짜가 하루 밀릴 수 있습니다. (API 스키마에서 NoticeResp.startAt이 Format: date로 정의됨) hasTime === false인 경우에는 dateString + 'T00:00:00'처럼 로컬 기준으로 파싱되도록 정규화하거나, YYYY-MM-DD를 직접 분해해 new Date(y, m-1, d)로 생성해서 월/일 표시가 타임존에 영향받지 않게 해주세요.

Suggested change
const date = new Date(dateString);
const now = new Date();
const hasTime = /\d{2}:\d{2}/.test(dateString);
const hasTime = /\d{2}:\d{2}/.test(dateString);
const date = hasTime
? new Date(dateString)
: (() => {
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(dateString);
if (!match) {
return new Date(dateString);
}
const [, year, month, day] = match;
return new Date(Number(year), Number(month) - 1, Number(day));
})();
const now = new Date();

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@copilot utc+9 타임존이면 상관없잖아?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

KST(UTC+9)로만 보면 대부분 문제 없어 보이지만, new Date('YYYY-MM-DD')는 UTC 파싱이라 기기 타임존이 바뀌면 날짜가 하루 밀릴 수 있어서 안전하게 보정했습니다. YYYY-MM-DD는 로컬 날짜(new Date(year, month-1, day))로 생성하도록 반영했고, 시간 포함 문자열은 기존대로 처리합니다. 반영 커밋: af9da7f.

UI 확인 스크린샷

Comment on lines +23 to +25
const date = new Date(dateString);
const now = new Date();
const hasTime = /\d{2}:\d{2}/.test(dateString);
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

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

dateStringYYYY-MM-DD(time 미포함)일 경우 new Date(dateString)는 UTC로 해석되어 로컬 타임존에 따라 ${month}월 ${day}일 결과가 하루씩 어긋날 수 있습니다. 이 화면에서는 notice.startAt(스키마상 Format: date)에도 formatDate를 사용하므로, hasTime === false이면 dateString + 'T00:00:00'로 정규화하거나 new Date(y, m-1, d)로 생성해 날짜 표시가 타임존에 의존하지 않도록 처리해주세요.

Suggested change
const date = new Date(dateString);
const now = new Date();
const hasTime = /\d{2}:\d{2}/.test(dateString);
const hasTime = /\d{2}:\d{2}/.test(dateString);
const date = !hasTime && /^\d{4}-\d{2}-\d{2}$/.test(dateString)
? (() => {
const [year, month, day] = dateString.split('-').map(Number);
return new Date(year, month - 1, day);
})()
: new Date(dateString);
const now = new Date();

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@copilot utc+9 한국 타임존이잖아

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.

3 participants