12 lines
371 B
TypeScript
12 lines
371 B
TypeScript
export default function formatDate(d: string | Date | number | null | undefined): string {
|
|
if (!d) return "Date inconnue";
|
|
|
|
const date = d instanceof Date ? d : new Date(d);
|
|
|
|
const jj = String(date.getUTCDate()).padStart(2, "0");
|
|
const mm = String(date.getUTCMonth() + 1).padStart(2, "0");
|
|
const aaaa = date.getUTCFullYear();
|
|
|
|
return `${jj}/${mm}/${aaaa}`;
|
|
}
|