[fit/mat-239] NotificationItem time formatDate 기능 수정#286
[fit/mat-239] NotificationItem time formatDate 기능 수정#286
Conversation
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>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
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
hasTimecheck (/\d{2}:\d{2}/) toformatDateto 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.
| const date = new Date(dateString); | ||
| const now = new Date(); | ||
| const hasTime = /\d{2}:\d{2}/.test(dateString); |
There was a problem hiding this comment.
dateString가 YYYY-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)로 생성해서 월/일 표시가 타임존에 영향받지 않게 해주세요.
| 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(); |
| const date = new Date(dateString); | ||
| const now = new Date(); | ||
| const hasTime = /\d{2}:\d{2}/.test(dateString); |
There was a problem hiding this comment.
dateString가 YYYY-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)로 생성해 날짜 표시가 타임존에 의존하지 않도록 처리해주세요.
| 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(); |
Agent-Logs-Url: https://github.com/team-ppointer/Pointer/sessions/a6e8162a-a6e8-4f07-b0c6-1641b0e1d545 Co-authored-by: b0nsu <125778250+b0nsu@users.noreply.github.com>

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
Testing
Risk / Impact
Screenshots / Video