date

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 ParseInterval added in v0.1.2

func ParseInterval(s string) (Interval, error)

func (Interval) String

func (p Interval) String() string

type Partition added in v0.1.2

type Partition struct {
	// contains filtered or unexported fields
}

func NewPartition added in v0.1.2

func NewPartition(period Period, interval Interval, last int) Partition

func (Partition) Align added in v0.1.2

func (part Partition) Align() mapper.Mapper[time.Time]

func (Partition) Contains added in v0.1.2

func (part Partition) Contains(d time.Time) bool

func (Partition) EndDates added in v0.1.2

func (part Partition) EndDates() []time.Time

func (Partition) Size added in v0.1.2

func (part Partition) Size() int

func (Partition) StartDates added in v0.1.2

func (part Partition) StartDates() []time.Time

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

Jump to

Keyboard shortcuts

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