diff --git a/components/Footer/Footer.tsx b/components/Footer/Footer.tsx index 9ad155c5..b68a9b2c 100644 --- a/components/Footer/Footer.tsx +++ b/components/Footer/Footer.tsx @@ -93,7 +93,7 @@ const Footer = ({ ...rest }: FooterProps) => ( 2001 {" "} - – {new Date().getFullYear()}. + – {new Date(process.env.NEXT_PUBLIC_RELEASE_DATE).getUTCFullYear()}.
diff --git a/lib/config/constants.ts b/lib/config/constants.ts index f65e4baf..abd83e82 100644 --- a/lib/config/constants.ts +++ b/lib/config/constants.ts @@ -2,7 +2,7 @@ export const NOTES_DIR = "./notes"; // normalize the timestamp saved when building/deploying (see next.config.js) and fall back to right now: -export const RELEASE_DATE = new Date(process.env.RELEASE_DATE ?? Date.now()).toISOString(); +export const RELEASE_DATE = new Date(process.env.NEXT_PUBLIC_RELEASE_DATE ?? Date.now()).toISOString(); // detect current backend environment export const IS_PROD = process.env.NEXT_PUBLIC_VERCEL_ENV === "production"; diff --git a/lib/helpers/parse-notes.ts b/lib/helpers/parse-notes.ts index 834108e5..20b72598 100644 --- a/lib/helpers/parse-notes.ts +++ b/lib/helpers/parse-notes.ts @@ -9,6 +9,7 @@ import { compiler } from "markdown-to-jsx"; import removeMarkdown from "remove-markdown"; import sanitizeHtml from "sanitize-html"; import readingTime from "reading-time"; +import { formatDateISO } from "./format-date"; import { baseUrl } from "../config"; import { NOTES_DIR } from "../config/constants"; @@ -56,7 +57,7 @@ export const getNoteData = (slug: string): Omit & { content: htmlTitle, slug, permalink: urlJoin(baseUrl, "notes", slug, "/"), - date: new Date(data.date).toISOString(), // validate/normalize the date string provided from front matter + date: formatDateISO(data.date), // validate/normalize the date string provided from front matter readingMins: Math.ceil(readingTime(content).minutes), }, content, diff --git a/next.config.js b/next.config.js index 941d6135..818517c6 100644 --- a/next.config.js +++ b/next.config.js @@ -24,7 +24,7 @@ module.exports = (phase, { defaultConfig }) => { productionBrowserSourceMaps: true, env: { // freeze build timestamp for when serverless pages need a "last updated" date: - RELEASE_DATE: new Date().toISOString(), + NEXT_PUBLIC_RELEASE_DATE: new Date().toISOString(), // check if we're running locally via `next dev`: IS_DEV_SERVER: phase === PHASE_DEVELOPMENT_SERVER, },