forked from tangled.org/core
Monorepo for Tangled

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

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>

authored by oppi.li and committed by Tangled 3fb7622b acce4932

Changed files
+6 -1
appview
pages
templates
repo
fragments
+6 -1
appview/pages/templates/repo/fragments/shortTimeAgo.html
··· 1 1 {{ define "repo/fragments/shortTimeAgo" }} 2 - {{ template "repo/fragments/timeWrapper" (dict "Time" . "Content" (print (. | shortRelTimeFmt) " ago")) }} 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) }} 3 8 {{ end }} 4 9