diff --git a/src/utils/formatDate.ts b/src/utils/formatDate.ts new file mode 100644 index 00000000..2003740e --- /dev/null +++ b/src/utils/formatDate.ts @@ -0,0 +1,13 @@ +/* eslint-disable import/no-duplicates */ +import { format } from 'date-fns'; +import { fr } from 'date-fns/locale'; + +/** + * Default date-fns format() wrapper to use in the app (all date to french) + * @param date + * @param formatStr + * @returns + */ +export default function (date: Date, formatStr = 'PP'): string { + return format(date, formatStr, { locale: fr }); +}