Skip to content

Commit

Permalink
Improved usage of <time> element for data shown on dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianLeChat committed Feb 5, 2024
1 parent 8a92468 commit 48318d4
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion app/[locale]/dashboard/components/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,23 @@ export const columns: ColumnDef<FileAttributes>[] = [
// Date de téléversement du fichier.
accessorKey: "date",
header: ( { column } ) => <ColumnHeader column={column} title="Date" />,
cell: ( { row } ) => row.original.versions[ 0 ].date.toLocaleDateString()
cell: ( { row } ) =>
{
const { date } = row.original.versions[ 0 ];

return (
<time dateTime={date.toISOString()}>
{new Intl.DateTimeFormat( undefined, {
year: "numeric",
month: "short",
day: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric"
} ).format( date )}
</time>
);
}
},
{
// Statut de partage du fichier.
Expand Down

0 comments on commit 48318d4

Please sign in to comment.