From c83c49b0e18f0593a62a8a7754d1ff49ac097289 Mon Sep 17 00:00:00 2001 From: tdro Date: Sat, 7 Oct 2023 20:19:06 -0400 Subject: themes/default: Make time and dates consistent Don't mix local time with UTC and fix future date calculation --- themes/default/layouts/partials/author-card.html | 6 +++--- themes/default/layouts/partials/base-footer.html | 2 +- themes/default/layouts/partials/function-generate-feeds.html | 6 +++--- themes/default/layouts/partials/meta-date-time.html | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'themes/default/layouts/partials') diff --git a/themes/default/layouts/partials/author-card.html b/themes/default/layouts/partials/author-card.html index 985f53a..02ab0b2 100644 --- a/themes/default/layouts/partials/author-card.html +++ b/themes/default/layouts/partials/author-card.html @@ -1,5 +1,5 @@ {{- $metadata := print "public/" .Data.user "/author.json" -}} -{{- $date := .Date.Local.Format "15:04 Jan 2 2006" -}} +{{- $date := .Date | time.Format "Mon Jan 2 2006" -}} {{- $host := (urls.Parse ("" | absURL)).Host -}} @@ -66,8 +66,8 @@ diff --git a/themes/default/layouts/partials/base-footer.html b/themes/default/layouts/partials/base-footer.html index a29ff93..d83f07c 100644 --- a/themes/default/layouts/partials/base-footer.html +++ b/themes/default/layouts/partials/base-footer.html @@ -5,7 +5,7 @@ {{- with .Site.Author.footer -}} {{- if $kind -}} {{ . | markdownify }} · - Copyright © {{ now.Format "2006"}} · + Copyright © {{ now | time.Format "2006"}} · {{- else -}} {{ or $author.footer $author.title | markdownify }} · {{- end -}} diff --git a/themes/default/layouts/partials/function-generate-feeds.html b/themes/default/layouts/partials/function-generate-feeds.html index 32f340d..348a8e9 100644 --- a/themes/default/layouts/partials/function-generate-feeds.html +++ b/themes/default/layouts/partials/function-generate-feeds.html @@ -19,7 +19,7 @@ {{- with $fetch | transform.Unmarshal -}} {{- $content := "" -}} - {{- $date := now.Format "2006-01-02T15:04:05Z" -}} + {{- $date := now | time.Format "2006-01-02T15:04:05Z" -}} {{- $description := "" -}} {{- $enclosure := "" -}} {{- $imageLink := "" -}} @@ -160,9 +160,9 @@ $feeds = $feeds | append (dict "FeedContent" ($content | plainify | html | htmlUnescape) "FeedContentShort" (delimit (first 2 (split ($content | plainify | html | htmlUnescape) "\n")) " " | truncate 250) - "FeedDate" ($date | plainify | html | htmlUnescape | time.Format "January 2, 2006") + "FeedDate" ($date | plainify | html | htmlUnescape | time.Format "Mon Jan 2 2006") "FeedDateTime" ($date | plainify | html | htmlUnescape | time.Format "2006-01-02T15:04:05Z") - "FeedDateTitle" ($date | plainify | html | htmlUnescape | time.Format "Monday, January 2 2006 at 15:04:05 MST") + "FeedDateTitle" ($date | plainify | html | htmlUnescape | time.Format "Monday January 2 2006 at 15:04:05 MST") "FeedDescription" ($description | plainify | html | htmlUnescape) "FeedDescriptionShort" (delimit (first 2 (split ($description | plainify | html | htmlUnescape) "\n")) " " | truncate 250) "FeedEnclosure" ($enclosure | plainify | html | htmlUnescape) diff --git a/themes/default/layouts/partials/meta-date-time.html b/themes/default/layouts/partials/meta-date-time.html index 5b26c68..1dc50f3 100644 --- a/themes/default/layouts/partials/meta-date-time.html +++ b/themes/default/layouts/partials/meta-date-time.html @@ -1,9 +1,9 @@ +title="{{ .Date | time.Format "Posted: Monday January 2 2006 at 15:04:05 MST" }} +{{ if .Lastmod.After .Date }}{{ .Lastmod | time.Format "Edited: Monday January 2 2006 at 15:04:05 MST" }}{{ end }}"> {{- safeHTML (readFile (print (partial "function-paths.html").static "/icons/feather/calendar.svg")) -}} {{- /* This comment removes trailing newlines and white spaces. */ -}} {{ if .Lastmod.After .Date }} -- cgit v1.2.3