date

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Iter added in v0.1.6

func Iter(from, to Date, duration Duration) iter.Seq[Date]

Types

type Cron added in v0.1.6

type Cron string

func (Cron) Matches added in v0.1.6

func (c Cron) Matches(day Date) bool

type Date

type Date int64

func FromTime

func FromTime(t time.Time) Date

func ParseDate

func ParseDate(str string) (Date, error)

func Today

func Today() Date

func (Date) Add

func (d Date) Add(days Duration) Date

func (Date) After

func (d Date) After(d2 Date) bool

func (Date) Before

func (d Date) Before(d2 Date) bool

func (Date) Day added in v0.1.6

func (d Date) Day() int

func (Date) IsZero

func (d Date) IsZero() bool

func (Date) MarshalJSON

func (d Date) MarshalJSON() ([]byte, error)

func (Date) Month added in v0.1.6

func (d Date) Month() time.Month

func (Date) String

func (d Date) String() string

func (Date) Sub

func (d Date) Sub(d2 Date) Duration

func (Date) ToStdTime

func (d Date) ToStdTime() time.Time

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(b []byte) (err error)

func (Date) Year added in v0.1.6

func (d Date) Year() int

type Duration

type Duration int64
const (
	Min   Duration = -Max
	Zero  Duration = 0
	Max   Duration = 1<<63 - 1
	Day   Duration = 1
	Week  Duration = 7 * Day
	Month Duration = 30 * Day
	Year  Duration = 365 * Day
)

func ParseDuration

func ParseDuration(str string) (d Duration, err error)

func Sub

func Sub(a, b time.Time) Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) Prettify

func (d Duration) Prettify() string

func (Duration) String

func (d Duration) String() string

func (Duration) ToStdTime

func (d Duration) ToStdTime() time.Duration

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) (err error)

func (Duration) Zero

func (d Duration) Zero() bool

Jump to

Keyboard shortcuts

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