MCPcopy Create free account
hub / github.com/basecamp/hey-cli / formatDisplayDate

Function formatDisplayDate

internal/tui/content.go:14–27  ·  view source on GitHub ↗

formatDisplayDate converts an ISO timestamp to "Nov 24, 2025" format.

(ts string)

Source from the content-addressed store, hash-verified

12
13// formatDisplayDate renders a timestamp as "Nov 24, 2025" in the reader's own zone, which
14// is the only zone the day is right in: a thread that arrived at 23:30 UTC belongs to the
15// next day east of it.
16func formatDisplayDate(ts time.Time) string {
17 if ts.IsZero() {
18 return ""
19 }
20 return ts.Local().Format("Jan 2, 2006")
21}
22
23// formatDisplayDateTime is for a thread's entries, where the day is not enough: a
24// back-and-forth answered within the hour is several entries on one date, and which
25// came when is the thing the reader is reading down the thread to find out.
26func formatDisplayDateTime(ts time.Time) string {
27 if ts.IsZero() {
28 return ""
29 }
30 return ts.Local().Format("Jan 2, 2006 15:04")

Callers 1

viewMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected