date

package
v0.1.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const CanonicalDate = "2006-01-02"

Variables

This section is empty.

Functions

func DefaultLocation

func DefaultLocation() *time.Location

func NumDays

func NumDays(from Date, to Date) int

Types

type Date

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

func FromTime

func FromTime(t time.Time) Date

func Make

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

func Parse

func Parse(s string) (Date, error)

func Today

func Today() Date

func Tomorrow

func Tomorrow() Date

func Yesterday

func Yesterday() Date

func (Date) AddDays

func (d Date) AddDays(days int) Date

func (Date) AddMonths

func (d Date) AddMonths(months int) Date

func (Date) AddYears

func (d Date) AddYears(years int) Date

func (Date) After

func (d Date) After(od Date) bool

func (Date) Before

func (d Date) Before(od Date) bool

func (Date) BeforeOrAt

func (d Date) BeforeOrAt(od Date) bool

func (Date) BetweenInclusive

func (d Date) BetweenInclusive(from, to Date) bool

func (Date) CanonicalString

func (d Date) CanonicalString() string

func (Date) Day

func (d Date) Day() int

func (Date) Format

func (d Date) Format() string

func (Date) FormatInLayout

func (d Date) FormatInLayout(layout string) string

func (Date) GermanWeekDay

func (d Date) GermanWeekDay() GermanWeekday

func (Date) ISOWeek

func (d Date) ISOWeek() ISOWeek

func (Date) IsZero

func (d Date) IsZero() bool

func (Date) MarshalJSON

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

func (Date) Month

func (d Date) Month() time.Month

func (Date) RFCString

func (d Date) RFCString() string

func (Date) String

func (d Date) String() string

func (Date) Sub

func (d Date) Sub(ot Date) time.Duration

func (Date) Time

func (d Date) Time() time.Time

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(data []byte) error

func (Date) WeekDay

func (d Date) WeekDay() time.Weekday

func (Date) Year

func (d Date) Year() int

type GermanWeekday

type GermanWeekday int
const (
	Monday GermanWeekday = 1 + iota
	Tuesday
	Wednesday
	Thursday
	Friday
	Saturday
	Sunday
)

func AllGermanWeekdays

func AllGermanWeekdays() []GermanWeekday

func AllGermanWorkingWeekdays

func AllGermanWorkingWeekdays() []GermanWeekday

func (GermanWeekday) Abbreviate

func (gwd GermanWeekday) Abbreviate() string

func (GermanWeekday) Name

func (gwd GermanWeekday) Name() string

type ISOWeek

type ISOWeek struct {
	Year int `json:"year"`
	Week int `json:"week"`
}

func DecodeISOWeek

func DecodeISOWeek(s string) (ISOWeek, error)

func (ISOWeek) AddWeeks

func (w ISOWeek) AddWeeks(n int) ISOWeek

func (ISOWeek) DateOf

func (w ISOWeek) DateOf(day GermanWeekday) Date

func (ISOWeek) Encode

func (w ISOWeek) Encode() string

func (ISOWeek) Format

func (w ISOWeek) Format() string

func (ISOWeek) Next

func (w ISOWeek) Next() ISOWeek

type YearMonth

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

func YearMonthNow

func YearMonthNow() YearMonth

func (YearMonth) AddMonths

func (ym YearMonth) AddMonths(n int) YearMonth

func (YearMonth) Month

func (ym YearMonth) Month() time.Month

func (YearMonth) Next

func (ym YearMonth) Next() YearMonth

func (YearMonth) Previous

func (ym YearMonth) Previous() YearMonth

func (YearMonth) String

func (ym YearMonth) String() string

func (YearMonth) Year

func (ym YearMonth) Year() int

Jump to

Keyboard shortcuts

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