diff --git a/client/src/components/DecisionSupportFilePage/MetadataPanel.tsx b/client/src/components/DecisionSupportFilePage/MetadataPanel.tsx index b3e753b..8ff0855 100644 --- a/client/src/components/DecisionSupportFilePage/MetadataPanel.tsx +++ b/client/src/components/DecisionSupportFilePage/MetadataPanel.tsx @@ -4,7 +4,7 @@ import { useWorkgroups } from '../../gql/queries/workgroups'; import { useUserProfile } from '../../gql/queries/profile'; import { inWorkgroup } from '../../types/workgroup'; import { DecisionSupportFileUpdaterProps } from './DecisionSupportFileUpdaterProps'; -import { asDate } from '../../util/date'; +import { asDate, formatDate } from '../../util/date'; import { Link } from 'react-router-dom'; export interface MetadataPanelProps extends DecisionSupportFileUpdaterProps {}; @@ -81,13 +81,13 @@ export const MetadataPanel: FunctionComponent = ({ dsf, upda
Créé le
-

{asDate(dsf.createdAt).toISOString()}

+

{formatDate(dsf.createdAt)}

Voté le
-

{dsf.votedAt ? dsf.votedAt : '--'}

+

{dsf.votedAt ? formatDate(dsf.votedAt) : '--'}

diff --git a/client/src/components/ProfilePage/ProfilePage.tsx b/client/src/components/ProfilePage/ProfilePage.tsx index 9194d24..2d442eb 100644 --- a/client/src/components/ProfilePage/ProfilePage.tsx +++ b/client/src/components/ProfilePage/ProfilePage.tsx @@ -25,12 +25,14 @@ export function ProfilePage() {
-

Mon profil

- - { - - } - +
+

Mon profil

+ + { + + } + +
diff --git a/client/src/components/UserForm.tsx b/client/src/components/UserForm.tsx index 8e94f4e..a17c034 100644 --- a/client/src/components/UserForm.tsx +++ b/client/src/components/UserForm.tsx @@ -1,5 +1,6 @@ import React, { useState, ChangeEvent, useEffect } from 'react'; import { User } from '../types/user'; +import { formatDate } from '../util/date'; export interface UserFormProps { user: User @@ -62,13 +63,13 @@ export function UserForm({ user, onChange }: UserFormProps) {
-

{state.user.connectedAt}

+

{formatDate(state.user.connectedAt)}

-

{state.user.createdAt}

+

{formatDate(state.user.createdAt)}

diff --git a/client/src/util/date.ts b/client/src/util/date.ts index c505858..5e966f4 100644 --- a/client/src/util/date.ts +++ b/client/src/util/date.ts @@ -1,4 +1,16 @@ export function asDate(d: string|Date): Date { if (typeof d === 'string') return new Date(d); return d; +} + +const intl = Intl.DateTimeFormat(navigator.language, { + weekday: 'long', + month: 'short', + day: 'numeric', + hour: 'numeric', minute: 'numeric', second: 'numeric', +}); + +export function formatDate(d: Date|string): string { + d = asDate(d); + return intl.format(d); } \ No newline at end of file