date

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Align added in v0.1.1

func Align(ds []time.Time) mapper.Mapper[time.Time]

func Date

func Date(year int, month time.Month, day int) time.Time

Date creates a new

func EndOf

func EndOf(d time.Time, p Interval) time.Time

EndOf returns the last date in the given period that contains the receiver.

func StartOf

func StartOf(d time.Time, p Interval) time.Time

StartOf returns the first date in the given period which contains the receiver.

func Today

func Today() time.Time

Today returns today's

Types

type Interval

type Interval int

Interval is a time interval.

const (
	// Once represents the beginning of the interval.
	Once Interval = iota
	// Daily is a daily interval.
	Daily
	// Weekly is a weekly interval.
	Weekly
	// Monthly is a monthly interval.
	Monthly
	// Quarterly is a quarterly interval.
	Quarterly
	// Yearly is a yearly interval.
	Yearly
)

func (Interval) String

func (p Interval) String() string

type Period

type Period struct {
	Start, End time.Time
}

func (Period) Clip added in v0.1.1

func (p Period) Clip(p2 Period) Period

func (Period) Contains added in v0.0.15

func (p Period) Contains(t time.Time) bool

func (Period) Dates added in v0.1.1

func (period Period) Dates(p Interval, n int) []time.Time

Jump to

Keyboard shortcuts

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