Phase 0.3: migrate date formatting to date-fns

This commit is contained in:
Agent Zero
2026-07-23 05:05:08 +02:00
parent 241850fddd
commit 57d18c1381
20 changed files with 133 additions and 56 deletions
+2 -6
View File
@@ -11,6 +11,7 @@ import { decodeMimeHeader } from '@/api/mail';
import { EmptyState } from '@/components/ui/EmptyState';
import { Pagination } from '@/components/ui/Pagination';
import { ChevronUp, Loader2, Paperclip, Star } from 'lucide-react';
import { formatSmartDate } from '@/utils/date';
export interface MailListProps {
mails: Mail[];
@@ -30,12 +31,7 @@ export interface MailListProps {
}
function formatDate(dateStr: string): string {
const date = new Date(dateStr);
const now = new Date();
if (date.toDateString() === now.toDateString()) {
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
}
return date.toLocaleDateString([], { month: 'short', day: 'numeric' });
return formatSmartDate(dateStr) || dateStr;
}
export function MailList({