From 18327c3964de5536e2f4579cea0a0a1cc810c722 Mon Sep 17 00:00:00 2001 From: Michael Rykov Date: Wed, 26 Jun 2024 20:44:01 +0800 Subject: [PATCH] Fixed timeStringWithAgo for sub-minute age --- cli/helpers.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/helpers.go b/cli/helpers.go index 21f57ec..76e91b5 100644 --- a/cli/helpers.go +++ b/cli/helpers.go @@ -14,7 +14,8 @@ func timeStringWithAgo(t time.Time) string { out := t.Local().Format("2006-01-02 15:04") if ago := time.Now().Sub(t); ago < 24*time.Hour { - if str := roundDurationRE.FindString(ago.String()); str != "" { + agoStr := ago.Round(time.Second).String() + if str := roundDurationRE.FindString(agoStr); str != "" { out = fmt.Sprintf("%s (~ %s ago)", out, str) } }