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

Function preciseAgo

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

Source from the content-addressed store, hash-verified

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

Callers 2

TestPreciseAgoFunction · 0.85
SelectRunFunction · 0.85

Calls 1

StringMethod · 0.65

Tested by 1

TestPreciseAgoFunction · 0.68