From e9f63a369dac7272016d5a436cb0dd359dbf1f9d Mon Sep 17 00:00:00 2001 From: Liam Date: Tue, 23 Apr 2024 21:59:22 +0100 Subject: [PATCH] add time uploaded to the paste --- src/app/(pages)/[id]/page.tsx | 17 ++++++++++++++--- src/app/(pages)/page.tsx | 2 +- src/app/layout.tsx | 3 ++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/app/(pages)/[id]/page.tsx b/src/app/(pages)/[id]/page.tsx index 1cb9d2c..187c906 100644 --- a/src/app/(pages)/[id]/page.tsx +++ b/src/app/(pages)/[id]/page.tsx @@ -21,7 +21,7 @@ type Paste = { /** * The date the paste was created. */ - created: number; + created: string; /** * The detected language of the paste. @@ -59,10 +59,13 @@ export async function generateMetadata({ description: "Not found", }; } + const created = moment(data.created) + .format("MMMM Do YYYY, h:mm:ss a") + .toString(); return { title: `Paste - ${id}.${data.language}`, - description: `Created: ${moment(data.created)}\n\nClick to view the paste.`, + description: `Created: ${created}\n\nClick to view the paste.`, }; } @@ -75,11 +78,19 @@ export default async function Paste({ return notFound(); } + const created = moment(data.created) + .format("MMMM Do YYYY, h:mm:ss a") + .toString(); + return ( -
+
+
+ +

{data.language}

+

{created}

diff --git a/src/app/(pages)/page.tsx b/src/app/(pages)/page.tsx index 688d3f6..4e1dc45 100644 --- a/src/app/(pages)/page.tsx +++ b/src/app/(pages)/page.tsx @@ -60,7 +60,7 @@ export default function Home(): ReactElement { />
-
+