MCPcopy
hub / github.com/cli/cli / preciseAgo

Function preciseAgo

pkg/cmd/run/shared/shared.go:657–666  ·  view source on GitHub ↗
(now time.Time, createdAt time.Time)

Source from the content-addressed store, hash-verified

655}
656
657func preciseAgo(now time.Time, createdAt time.Time) string {
658 ago := now.Sub(createdAt)
659
660 if ago < 30*24*time.Hour {
661 s := ago.Truncate(time.Second).String()
662 return fmt.Sprintf("%s ago", s)
663 }
664
665 return createdAt.Format("Jan _2, 2006")
666}

Callers 2

TestPreciseAgoFunction · 0.85
SelectRunFunction · 0.85

Calls 1

StringMethod · 0.45

Tested by 1

TestPreciseAgoFunction · 0.68