Skip to content

Commit 18327c3

Browse files
committed
Fixed timeStringWithAgo for sub-minute age
1 parent 8195a01 commit 18327c3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cli/helpers.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ func timeStringWithAgo(t time.Time) string {
1414
out := t.Local().Format("2006-01-02 15:04")
1515

1616
if ago := time.Now().Sub(t); ago < 24*time.Hour {
17-
if str := roundDurationRE.FindString(ago.String()); str != "" {
17+
agoStr := ago.Round(time.Second).String()
18+
if str := roundDurationRE.FindString(agoStr); str != "" {
1819
out = fmt.Sprintf("%s (~ %s ago)", out, str)
1920
}
2021
}

0 commit comments

Comments
 (0)