date

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePartition added in v0.0.16

func CreatePartition(t0, t1 time.Time, p Interval, n int) []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 Map added in v0.0.16

func Map(part []time.Time) func(time.Time) time.Time

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
}

Period represents a time period

func Periods

func Periods(t0, t1 time.Time, p Interval) []Period

Periods returns a series of periods in the given interval, which contains both t0 and t1.

func PeriodsN added in v0.0.16

func PeriodsN(t0, t1 time.Time, p Interval, n int) []Period

Periods returns a series of periods in the given interval, which contains both t0 and t1.

func (Period) Contains added in v0.0.15

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

Contains returns whether the period contains the given

func (Period) Less added in v0.0.16

func (p Period) Less(p2 Period) bool

Less defines an ordering for periods.

Jump to

Keyboard shortcuts

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