appview/pages: special-case for sub-second times in timeAgo formats #568

merged
opened by oppi.li targeting master from push-wsxnywmtsnrp

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 me@oppi.li

Changed files
+6 -1
appview
pages
templates
repo
fragments
+6 -1
appview/pages/templates/repo/fragments/shortTimeAgo.html
··· 1 {{ define "repo/fragments/shortTimeAgo" }} 2 - {{ template "repo/fragments/timeWrapper" (dict "Time" . "Content" (print (. | shortRelTimeFmt) " ago")) }} 3 {{ end }} 4
··· 1 {{ define "repo/fragments/shortTimeAgo" }} 2 + {{ $formatted := shortRelTimeFmt . }} 3 + {{ $content := printf "%s ago" $formatted }} 4 + {{ if eq $formatted "now" }} 5 + {{ $content = "now" }} 6 + {{ end }} 7 + {{ template "repo/fragments/timeWrapper" (dict "Time" . "Content" $content) }} 8 {{ end }} 9