Phase 0.3: migrate date formatting to date-fns
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user