fix: API 에러 코드 표시 및 오늘의 이슈 시간 포맷 수정

- ApiResponse::error() 메시지에 상태 코드 포함 ([{code}] {message})
- TodayIssueService 시간 포맷을 상대시간에서 실제시간으로 변경
  - 오늘: "14:30"
  - 어제: "어제 14:30"
  - 그 외: "1/22 14:30"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 20:48:43 +09:00
parent 6477cd8f78
commit 57229b3cc6
2 changed files with 14 additions and 18 deletions

View File

@@ -193,7 +193,10 @@ public function cleanupExpiredIssues(): int
}
/**
* 상대 시간 포맷팅
* 등록 시간 포맷팅
* - 오늘: "14:30"
* - 어제: "어제 14:30"
* - 그 외: "1/22 14:30"
*/
private function formatRelativeTime(?Carbon $datetime): string
{
@@ -202,26 +205,19 @@ private function formatRelativeTime(?Carbon $datetime): string
}
$now = Carbon::now();
$diffInMinutes = $now->diffInMinutes($datetime);
$diffInHours = $now->diffInHours($datetime);
$diffInDays = $now->diffInDays($datetime);
$time = $datetime->format('H:i');
if ($diffInMinutes < 60) {
return __('message.today_issue.time_minutes_ago', ['minutes' => max(1, $diffInMinutes)]);
// 오늘
if ($datetime->isToday()) {
return $time;
}
if ($diffInHours < 24) {
return __('message.today_issue.time_hours_ago', ['hours' => $diffInHours]);
// 어제
if ($datetime->isYesterday()) {
return __('message.today_issue.time_yesterday').' '.$time;
}
if ($diffInDays == 1) {
return __('message.today_issue.time_yesterday');
}
if ($diffInDays < 7) {
return __('message.today_issue.time_days_ago', ['days' => $diffInDays]);
}
return $datetime->format('Y-m-d');
// 그 외
return $datetime->format('n/j').' '.$time;
}
}