| // Format timestamp to readable date | |
| export function formatDate(timestamp: number) { | |
| const date = new Date(timestamp); | |
| const now = new Date(); | |
| const isToday = date.toDateString() === now.toDateString(); | |
| if (isToday) { | |
| return date.toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' }); | |
| } else { | |
| return date.toLocaleDateString('zh-CN', { month: 'short', day: 'numeric' }); | |
| } | |
| }; | |