Checkpoint: Correction de l'erreur React #31 dans le modal de détails du calendrier en gérant correctement la conversion des objets Date en string avant affichage
This commit is contained in:
@@ -246,16 +246,20 @@ export default function AdminCalendrier() {
|
||||
)}
|
||||
</div>
|
||||
|
||||
{selectedSequence.datesFormation && selectedSequence.datesFormation.length > 0 && (
|
||||
{selectedSequence.dates && selectedSequence.dates.length > 0 && (
|
||||
<div>
|
||||
<p className="text-sm font-medium text-muted-foreground mb-2">Dates de formation</p>
|
||||
<div className="space-y-1">
|
||||
{selectedSequence.datesFormation.map((dateForm: any, index: number) => (
|
||||
<div key={index} className="text-sm bg-muted p-2 rounded">
|
||||
Du {format(parseISO(dateForm.dateDebut), "dd/MM/yyyy", { locale: fr })} au{" "}
|
||||
{format(parseISO(dateForm.dateFin), "dd/MM/yyyy", { locale: fr })}
|
||||
</div>
|
||||
))}
|
||||
{selectedSequence.dates.map((dateForm: any, index: number) => {
|
||||
const dateDebut = typeof dateForm.dateDebut === 'string' ? parseISO(dateForm.dateDebut) : dateForm.dateDebut;
|
||||
const dateFin = typeof dateForm.dateFin === 'string' ? parseISO(dateForm.dateFin) : dateForm.dateFin;
|
||||
return (
|
||||
<div key={index} className="text-sm bg-muted p-2 rounded">
|
||||
Du {format(dateDebut, "dd/MM/yyyy", { locale: fr })} au{" "}
|
||||
{format(dateFin, "dd/MM/yyyy", { locale: fr })}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user