From a516fec4e0ff719471dc7197210b02a0807249d7 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Wed, 10 Sep 2025 10:05:23 +0100 Subject: [PATCH] appview/pages: special-case for sub-second times in timeAgo formats Change-Id: wsxnywmtsnrpwmrvpuynxvxqypurkrut when time is formatted in "timeago" formats, it can be displayed as "edited now ago" when the time is sub-second. this case is now specialized to omit the "ago" to result in "edited now". Signed-off-by: oppiliappan --- appview/pages/templates/repo/fragments/shortTimeAgo.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/appview/pages/templates/repo/fragments/shortTimeAgo.html b/appview/pages/templates/repo/fragments/shortTimeAgo.html index 080941a7..e1ae526a 100644 --- a/appview/pages/templates/repo/fragments/shortTimeAgo.html +++ b/appview/pages/templates/repo/fragments/shortTimeAgo.html @@ -1,4 +1,9 @@ {{ define "repo/fragments/shortTimeAgo" }} -{{ template "repo/fragments/timeWrapper" (dict "Time" . "Content" (print (. | shortRelTimeFmt) " ago")) }} + {{ $formatted := shortRelTimeFmt . }} + {{ $content := printf "%s ago" $formatted }} + {{ if eq $formatted "now" }} + {{ $content = "now" }} + {{ end }} + {{ template "repo/fragments/timeWrapper" (dict "Time" . "Content" $content) }} {{ end }} -- 2.43.0