From a05fa510fd1ac1640cfde89e6ba68e7c97fd1a29 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Fri, 20 Mar 2026 10:04:00 +0000 Subject: [PATCH] blog: use standard time formatting helper Signed-off-by: oppiliappan --- appview/pages/funcmap.go | 3 +++ blog/templates/index.html | 4 ++-- blog/templates/post.html | 2 +- blog/templates/text.html | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go index 73caa97a..c0d22bc5 100644 --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -195,6 +195,9 @@ func (p *Pages) funcMap() template.FuncMap { {D: math.MaxInt64, Format: "a long while %s", DivBy: 1}, }) }, + "shortTimeFmt": func(t time.Time) string { + return t.Format("Jan 2, 2006") + }, "longTimeFmt": func(t time.Time) string { return t.Format("Jan 2, 2006, 3:04 PM MST") }, diff --git a/blog/templates/index.html b/blog/templates/index.html index a41c556f..72ffe1cb 100644 --- a/blog/templates/index.html +++ b/blog/templates/index.html @@ -31,7 +31,7 @@
- {{ $date := .ParsedDate }}{{ $date.Format "Jan 2, 2006" }} + {{ $date := .ParsedDate }}{{ $date | shortTimeFmt}} {{ if .Meta.Draft }}[draft]{{ end }}

{{ .Meta.Title }}

@@ -67,7 +67,7 @@
- {{ $date := .ParsedDate }}{{ $date.Format "Jan 02, 2006" }} + {{ $date := .ParsedDate }}{{ $date | shortTimeFmt }}
{{ end }} diff --git a/blog/templates/post.html b/blog/templates/post.html index 9bd76552..eca64919 100644 --- a/blog/templates/post.html +++ b/blog/templates/post.html @@ -35,7 +35,7 @@ {{ $authors := .Post.Meta.Authors }}

{{ $date := .Post.ParsedDate }} - {{ $date.Format "02 Jan, 2006" }} + {{ $date | shortTimeFmt }}

diff --git a/blog/templates/text.html b/blog/templates/text.html index 19fbaf51..ff0bec3e 100644 --- a/blog/templates/text.html +++ b/blog/templates/text.html @@ -51,7 +51,7 @@

{{ $dateStr := index .Meta "date" }} {{ $date := parsedate $dateStr }} - {{ $date.Format "02 Jan, 2006" }} + {{ $date.Format | shortTimeFmt }} · -- 2.51.2