date

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDiffString

func GetDiffString(start, end time.Time, options *DiffDisplayOptions) (string, error)

func NumDaysDiff

func NumDaysDiff(start, end time.Time) (numDays int, err error)

Types

type Diff

type Diff struct {
	Years, Months, Days, Hours, Minutes int
}

func GetDiff

func GetDiff(start, end time.Time) (d Diff, err error)

func (Diff) Display

func (d Diff) Display(options *DiffDisplayOptions) (string, error)

type DiffDisplayOptions

type DiffDisplayOptions struct {
	ShowLeading     bool
	AlwaysShowYear  bool
	AlwaysShowMonth bool
	AlwaysShowDay   bool
	AlwaysShowHour  bool
	Granularity     TimeUnit
	// contains filtered or unexported fields
}

type TimeUnit

type TimeUnit int
const (
	Minute TimeUnit = iota
	Hour
	Day
	Month
	Year
)

Jump to

Keyboard shortcuts

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