aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/mentions-legales.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-12 17:24:13 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit00f147a7a687d5772bcc538bc606cfff972178cd (patch)
tree27eabeb83c05e14162c51b69d4a6f36d461947fc /src/pages/mentions-legales.tsx
parentc87c615b5866b8a8f361eeb0764bfdea85740e90 (diff)
feat(components): add a Time component
Instead of using helpers functions to format the date each time we need to use a time element, it makes more sense to create a new component dedicated to this task.
Diffstat (limited to 'src/pages/mentions-legales.tsx')
-rw-r--r--src/pages/mentions-legales.tsx18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/pages/mentions-legales.tsx b/src/pages/mentions-legales.tsx
index 25c2dd9..4e14d90 100644
--- a/src/pages/mentions-legales.tsx
+++ b/src/pages/mentions-legales.tsx
@@ -12,12 +12,12 @@ import {
PageLayout,
Figure,
type MetaItemData,
+ Time,
} from '../components';
import LegalNoticeContent, { meta } from '../content/pages/legal-notice.mdx';
import type { NextPageWithLayout } from '../types';
import { ROUTES } from '../utils/constants';
import {
- getFormattedDate,
getSchemaJson,
getSinglePageSchema,
getWebPageSchema,
@@ -47,18 +47,6 @@ const LegalNoticePage: NextPageWithLayout = () => {
url: ROUTES.LEGAL_NOTICE,
});
- /**
- * Retrieve a formatted date (and time).
- *
- * @param {string} date - A date string.
- * @returns {JSX.Element} The formatted date wrapped in a time element.
- */
- const getDate = (date: string): JSX.Element => {
- const isoDate = new Date(`${date}`).toISOString();
-
- return <time dateTime={isoDate}>{getFormattedDate(date)}</time>;
- };
-
const headerMeta: (MetaItemData | undefined)[] = [
{
id: 'publication-date',
@@ -67,7 +55,7 @@ const LegalNoticePage: NextPageWithLayout = () => {
description: 'Page: publication date label',
id: '4QbTDq',
}),
- value: getDate(dates.publication),
+ value: <Time date={dates.publication} />,
},
dates.update
? {
@@ -77,7 +65,7 @@ const LegalNoticePage: NextPageWithLayout = () => {
description: 'Page: update date label',
id: 'Ez8Qim',
}),
- value: getDate(dates.update),
+ value: <Time date={dates.update} />,
}
: undefined,
];