website/app/hooks/useFormattedDate.ts
2024-10-30 09:53:31 +01:00

7 lines
274 B
TypeScript

export function useFormattedDate(_date: string) {
const date = new Date(_date);
const month = date.getUTCMonth().toString().padStart(2, "0");
const monthDate = date.getUTCDate().toString().padStart(2, "0");
return `${date.getUTCFullYear()}-${month}-${monthDate}`;
}