relativeToNow renders a fuzzy, human readable description of when t occurs relative to the current time, for annotating the absolute expiry timestamp. Future times read as "in about 7 hours" and already-elapsed times as "expired about 2 days ago".
(t time.Time)
| 77 | // annotating the absolute expiry timestamp. Future times read as "in about 7 hours" and already-elapsed times as |
| 78 | // "expired about 2 days ago". |
| 79 | func relativeToNow(t time.Time) string { |
| 80 | now := timeNow() |
| 81 | if t.After(now) { |
| 82 | return text.FuzzyIn(now, t) |
| 83 | } |
| 84 | return "expired " + text.FuzzyAgo(now, t) |
| 85 | } |
| 86 | |
| 87 | func (e authEntry) String(cs *iostreams.ColorScheme) string { |
| 88 | var sb strings.Builder |
no test coverage detected