(dateStr: string)
| 62 | |
| 63 | // Format relative time |
| 64 | export function formatRelativeTime(dateStr: string): string { |
| 65 | const date = new Date(dateStr); |
| 66 | const now = new Date(); |
| 67 | const diffMs = now.getTime() - date.getTime(); |
| 68 | |
| 69 | if (diffMs < 60000) { |
| 70 | return '刚刚'; |
| 71 | } |
| 72 | if (diffMs < 3600000) { |
| 73 | return `${Math.floor(diffMs / 60000)} 分钟前`; |
| 74 | } |
| 75 | if (diffMs < 86400000) { |
| 76 | return `${Math.floor(diffMs / 3600000)} 小时前`; |
| 77 | } |
| 78 | return `${Math.floor(diffMs / 86400000)} 天前`; |
| 79 | } |
| 80 | |
| 81 | // Get status color class |
| 82 | export function getStatusColor(status: string): string { |
no outgoing calls
no test coverage detected