From 87b3e34fab9b67e830062ec4f18d0608704f923c Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 20 Nov 2024 22:53:30 -0600 Subject: [PATCH] avoid timezone entirely --- src/components/PublishedDate/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/PublishedDate/index.js b/src/components/PublishedDate/index.js index 7f58511ce8..815a1b2b82 100644 --- a/src/components/PublishedDate/index.js +++ b/src/components/PublishedDate/index.js @@ -11,9 +11,10 @@ const PublishedDate = ({ dateString, className }) => { // Turn ReleaseNoteData.frontmatter.published_date into a date object. // And then format it as Month Day, Year. // https://stackoverflow.com/questions/3552461/how-to-format-a-javascript-date - const date = new Date(`${dateString}T00:00:00Z`); // Interpret as UTC midnight - const options = { year: "numeric", month: "long", day: "numeric", timeZone: "UTC" }; // Format as UTC - const formattedDate = date.toLocaleDateString(undefined, options) + + const [year, month, day] = dateString.split("-"); // Extract year, month, and day + const formattedDate = `${new Date(year, month - 1).toLocaleString('default', { month: 'long' })} ${parseInt(day)}, ${year}`; + return (