Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DateTimePrinter ¶ added in v0.2.0
type DateTimePrinter struct { // DateFormat to use for printing timestamps beyond a day old. DateFormat string // Now allows you use a fixed point in time when printing. // This is useful when printing tables of data, so all the relative times // are in relation to the same "now", and when unit testing. Now func() time.Time }
DateTimePrinter uses go-humanize to print just the time portion of recent timestamps (within the last day) and for anything past a day, only prints the date portion of the timestamp.
func (DateTimePrinter) DateFormatOrDefault ¶ added in v0.2.0
func (t DateTimePrinter) DateFormatOrDefault() string
DateFormatOrDefault gets the format to apply to dates.
func (DateTimePrinter) Format ¶ added in v0.2.0
func (t DateTimePrinter) Format(value time.Time) string
Format the specified timestamp relative to now.
func (DateTimePrinter) NowOrDefault ¶ added in v0.2.0
func (t DateTimePrinter) NowOrDefault() time.Time
NowOrDefault gets the current time, using the overridden Now(), or time.Now().
Click to show internal directories.
Click to hide internal directories.