From 8916ebb5698e6f97100f95b050ea5d3ae64f4922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Wed, 19 Jun 2024 09:04:50 +0400 Subject: [PATCH] Create lib/formatDate.js --- lib/format.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/format.js b/lib/format.js index bf5f3af..cdd4873 100644 --- a/lib/format.js +++ b/lib/format.js @@ -1,3 +1,6 @@ +import {format} from 'date-fns' +import {fr} from 'date-fns/locale' + export function formatKonstitisyon(titres, articles) { const konstitisyon = [] @@ -15,3 +18,9 @@ export function formatKonstitisyon(titres, articles) { return konstitisyon } + +export function formatDate(date, formatStr = 'PP') { + return format(date, formatStr, { + locale: fr + }) +}