ui

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ui formats values for display in user interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RelativeTime

type RelativeTime struct {
	// DateAfter is how far in the past a time must be to show as a date
	// instead of a relative time. Zero means seven days.
	DateAfter time.Duration
	// DateLayout is the time.Format layout for dates. Empty means "2 Jan 2006".
	DateLayout string
	// Location is the time zone dates are shown in. Nil means time.Local.
	Location *time.Location
	// Zero is the text for the zero time, such as "never".
	Zero string
}

RelativeTime formats past times relative to now, the way a person reads them: "just now", "5m ago", "3h ago", "2d ago", and then a date once the time is DateAfter or more in the past. The zero value is ready to use.

func (RelativeTime) Format

func (r RelativeTime) Format(t time.Time) string

Format formats t relative to the current time.

func (RelativeTime) FormatAt

func (r RelativeTime) FormatAt(t, now time.Time) string

FormatAt formats t relative to now. Times after now, such as from a slightly fast clock elsewhere, show as "just now".

Directories

Path Synopsis
Package gio fills gaps in Gio's widgets: Ctrl-modified word motion and deletion for editors, and mouse wheel scrolling by whole notches.
Package gio fills gaps in Gio's widgets: Ctrl-modified word motion and deletion for editors, and mouse wheel scrolling by whole notches.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL