MCPcopy Create free account
hub / github.com/cli/cli / preciseAgo

Function preciseAgo

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

Source from the content-addressed store, hash-verified

682}
683
684func preciseAgo(now time.Time, createdAt time.Time) string {
685 ago := now.Sub(createdAt)
686
687 if ago < 30*24*time.Hour {
688 s := ago.Truncate(time.Second).String()
689 return fmt.Sprintf("%s ago", s)
690 }
691
692 return createdAt.Format("Jan _2, 2006")
693}

Callers 2

TestPreciseAgoFunction · 0.85
SelectRunFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by 1

TestPreciseAgoFunction · 0.68