export function formatDateLetter(d: string | Date | null | undefined): string { if (!d) return "Date inconnue"; const dateObj = d instanceof Date ? d : new Date(d); if (isNaN(dateObj.getTime())) return "Date invalide"; const monthNames = [ "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" ]; const day = dateObj.getDate().toString().padStart(2, "0"); const month = monthNames[dateObj.getMonth()]; const year = dateObj.getFullYear(); const hours = dateObj.getHours().toString().padStart(2, "0"); const minutes = dateObj.getMinutes().toString().padStart(2, "0"); return `${day} ${month} ${year} à ${hours}:${minutes}`; } export function formatDateLetterJS(d: string): string { const monthNames = [ "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre" ]; const [year, month, day] = d.split("-"); if (!year || !month || !day) return "Date invalide"; return `${day} ${monthNames[parseInt(month, 10) - 1]} ${year}`; }