From c13c1447bed63d3f0b03cd029a4adac4ea0d158c Mon Sep 17 00:00:00 2001 From: smitp.cc Date: Tue, 21 Jul 2026 15:56:57 +0000 Subject: [PATCH] appview/commit: future-dated commits display as "now" in commit list view Fixes [#672](https://tangled.org/tangled.org/core/issues/672) --- appview/pages/funcmap.go | 3 +++ appview/pages/templates/repo/fragments/shortTimeAgo.html | 2 +- 2 file(s) changed, 4 insertion(s)(+), 1 deletion(s)(-) diff --git a/appview/pages/funcmap.go b/appview/pages/funcmap.go --- a/appview/pages/funcmap.go +++ b/appview/pages/funcmap.go @@ -285,6 +285,9 @@ {D: humanize.LongTime, Format: "%dy %s", DivBy: humanize.Year}, {D: math.MaxInt64, Format: "a long while %s", DivBy: 1}, }) }, + "isFutureTime": func(t time.Time) bool { + return t.After(time.Now()) + }, "shortTimeFmt": func(t time.Time) string { return t.Format("Jan 2, 2006") }, diff --git a/appview/pages/templates/repo/fragments/shortTimeAgo.html b/appview/pages/templates/repo/fragments/shortTimeAgo.html --- a/appview/pages/templates/repo/fragments/shortTimeAgo.html +++ b/appview/pages/templates/repo/fragments/shortTimeAgo.html @@ -1,7 +1,7 @@ {{ define "repo/fragments/shortTimeAgo" }} {{ $formatted := shortRelTimeFmt . }} {{ $content := printf "%s ago" $formatted }} - {{ if eq $formatted "now" }} + {{ if or (eq $formatted "now") (isFutureTime .) }} {{ $content = "now" }} {{ end }} {{ template "repo/fragments/timeWrapper" (dict "Time" . "Content" $content) }} -- tangled.sh