From 4b4e7f7f316ac86fca7db4956d38ce2d93451b1d Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 13 Sep 2024 21:19:59 +0100 Subject: [PATCH] add short time back to the build info --- next.config.mjs | 8 ++++++++ src/common/website-utils.ts | 3 ++- src/components/footer.tsx | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/next.config.mjs b/next.config.mjs index 90d4b78..91397cd 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,6 +1,8 @@ import nextBuildId from "next-build-id"; import path from 'path'; import { fileURLToPath } from 'url'; +import {format} from '@formkit/tempo' + const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file const __dirname = path.dirname(__filename); // get the name of the directory @@ -16,8 +18,14 @@ const nextConfig = { hour: "numeric", minute: "numeric", timeZoneName: "short", + }), + NEXT_PUBLIC_BUILD_TIME_SHORT: format(new Date(), { + date: "short", + time: "short", }) } }; +console.log(`NEXT_PUBLIC_BUILD_TIME_SHORT: ${nextConfig.env.NEXT_PUBLIC_BUILD_TIME_SHORT}`); + export default nextConfig; diff --git a/src/common/website-utils.ts b/src/common/website-utils.ts index 4611280..ae1369c 100644 --- a/src/common/website-utils.ts +++ b/src/common/website-utils.ts @@ -26,6 +26,7 @@ export function getBuildInformation() { : "dev" : ""; const buildTime = process.env.NEXT_PUBLIC_BUILD_TIME; + const buildTimeShort = process.env.NEXT_PUBLIC_BUILD_TIME_SHORT; - return { buildId, buildTime }; + return { buildId, buildTime, buildTimeShort }; } diff --git a/src/components/footer.tsx b/src/components/footer.tsx index f7a32c6..b03b808 100644 --- a/src/components/footer.tsx +++ b/src/components/footer.tsx @@ -18,12 +18,13 @@ const items: NavbarItem[] = [ ]; export default function Footer() { - const { buildId, buildTime } = getBuildInformation(); + const { buildId, buildTime, buildTimeShort } = getBuildInformation(); return (

Build: {buildId} ({buildTime}) + ({buildTimeShort})

{items.map((item, index) => {