diff --git a/src/components/AppartCard.jsx b/src/components/AppartCard.jsx index 9b2178e..f51f82b 100644 --- a/src/components/AppartCard.jsx +++ b/src/components/AppartCard.jsx @@ -87,12 +87,15 @@ export default function AppartCard({ annonce, onDelete, onUpdated }) { const avgNote = noteP || noteA ? ((noteP + noteA) / (noteP && noteA ? 2 : 1)).toFixed(1) : null; - const dateDispo = annonce.DATE_DISPO - ? new Date(annonce.DATE_DISPO).toLocaleDateString("fr-FR", { - day: "numeric", - month: "short", - year: "numeric", - }) + const dateDispo = annonce.DATE_DISPO && annonce.DATE_DISPO.trim() + ? (() => { + const date = new Date(annonce.DATE_DISPO); + return isNaN(date.getTime()) ? null : date.toLocaleDateString("fr-FR", { + day: "numeric", + month: "short", + year: "numeric", + }); + })() : null; const dateAjout = annonce.createdAt