Skip to content

Commit

Permalink
feat: format date in readable french
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricss committed Nov 12, 2024
1 parent fed895f commit 3862e4c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/espace-laureat/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Badge from "@codegouvfr/react-dsfr/Badge";
import { format } from "date-fns";
import { fr } from "date-fns/locale/fr";
import { redirect } from "next/navigation";

import { getDemoDossierNumber } from "@/utils/demo";
Expand All @@ -16,14 +18,19 @@ export default async function EspaceLaureat() {

const demoDossierNumber = getDemoDossierNumber();
const dossier = await getDossier(demoDossierNumber);
const dateTraitement = format(
new Date(dossier.dateTraitement),
"dd MMMM yyyy",
{ locale: fr },
);

return (
<div className="max-w-2xl pb-24">
<h1>Espace lauréat</h1>
<div>
<h2>Dossier n°{dossier.number}</h2>
<Badge severity="success">
{dossier.state} le {dossier.dateTraitement}
{dossier.state} le {dateTraitement}
</Badge>
</div>
</div>
Expand Down
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
},
"dependencies": {
"@codegouvfr/react-dsfr": "^1.14.2",
"date-fns": "^4.1.0",
"graphql": "^16.9.0",
"graphql-request": "^7.1.2",
"iron-session": "^8.0.3",
Expand Down

0 comments on commit 3862e4c

Please sign in to comment.