Skip to content

Commit

Permalink
feat(formatDate): custom wrapper to format all date to FR
Browse files Browse the repository at this point in the history
  • Loading branch information
Clm-Roig committed Mar 16, 2022
1 parent 08c6010 commit b1264ae
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/utils/formatDate.ts
Original file line number Diff line number Diff line change
@@ -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 });
}

0 comments on commit b1264ae

Please sign in to comment.