From dd5941ec22d681cd296b00191a2dd4a23da1ec10 Mon Sep 17 00:00:00 2001 From: Ian Clarke Date: Sun, 23 Aug 2026 09:16:27 -0500 Subject: [PATCH] fix: format news dates server-side to avoid timezone off-by-one The include-releases=true news list emitted dates as midnight UTC (2006-01-02T15:04:05Z format) and then reformatted them client-side with toLocaleDateString in the viewer's local timezone. Midnight UTC converted to any negative-offset zone lands on the previous calendar day, so every article showed one day early for viewers west of UTC. --- .../themes/freenet/layouts/shortcodes/latest-news.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hugo-site/themes/freenet/layouts/shortcodes/latest-news.html b/hugo-site/themes/freenet/layouts/shortcodes/latest-news.html index 84af2f0b..c48f6162 100644 --- a/hugo-site/themes/freenet/layouts/shortcodes/latest-news.html +++ b/hugo-site/themes/freenet/layouts/shortcodes/latest-news.html @@ -12,7 +12,7 @@ {{ $newsItems := slice }} {{ range first 10 $sortedNews }} {{ $tags := .Params.tags | default slice }} - {{ $newsItems = $newsItems | append (dict "date" (.Date.Format "2006-01-02T15:04:05Z") "title" .Title "url" .Permalink "tags" $tags "type" "news") }} + {{ $newsItems = $newsItems | append (dict "date" (.Date.Format "2006-01-02T15:04:05Z") "dateDisplay" (.Date.Format "January 2, 2006") "title" .Title "url" .Permalink "tags" $tags "type" "news") }} {{ end }}
@@ -40,7 +40,12 @@ let html = ''; container.innerHTML = html;