diff --git a/components/news.tsx b/components/news.tsx index f3ac6050..caf0e9d4 100644 --- a/components/news.tsx +++ b/components/news.tsx @@ -56,6 +56,12 @@ export function News() { const formatDate = (dateString: string) => { try { const date = new Date(dateString); + + // Check if date is valid before using formatDistance + if (isNaN(date.getTime())) { + return dateString; // Return original string if date is invalid + } + return formatDistance(date, new Date(), { addSuffix: true, locale: fr @@ -122,7 +128,7 @@ export function News() {
+
{item.description}