datetime

package module
v0.10.0-rc10 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2025 License: BSD-3-Clause Imports: 8 Imported by: 0

README ¶

datetime

extending datetime

Static Badge

GoDoc GitHub stars Go Report Card codecov

Vesions

Stable Version GitHub Release GitHub Release

Installation

To use this package in your Go project, run:

go get -u github.com/gouef/datetime

Contributing

Read Contributing

Contributors

Join our Discord Community! 🎉

Discord

Click above to join our community on Discord!

Documentation ¶

Index ¶

Constants ¶

This section is empty.

Variables ¶

View Source
var (
	RANGE_START_STRICT   RangeStart = "["
	RANGE_START_OPTIONAL RangeStart = "("
	RANGE_END_STRICT     RangeEnd   = "]"
	RANGE_END_OPTIONAL   RangeEnd   = ")"
)

Functions ¶

func Calculate ¶ added in v0.10.0

func Calculate(year int) time.Time

func DaysInMonth ¶

func DaysInMonth(year int, month int) int

func DaysInMonthByDate ¶

func DaysInMonthByDate(t time.Time) int

func DaysInMonthList ¶ added in v0.10.0

func DaysInMonthList(year int, month int) []int

func GetDate ¶

func GetDate(year int, month int, day int) time.Time

func GetEaster ¶

func GetEaster(year int) time.Time

func GetGoodFriday ¶

func GetGoodFriday(year int) time.Time

func GetMonday ¶

func GetMonday(year int) time.Time

Types ¶

type Date ¶

type Date struct {
	Year     int
	Month    int `validate:"min=1,max=12"`
	Day      int `validate:"min=1,max=31"`
	Hour     int `validate:"min=0,max=23"`
	Minute   int `validate:"min=0,max=59"`
	Second   int `validate:"min=0,max=59"`
	DateTime time.Time
}

func DateFromString ¶ added in v0.10.0

func DateFromString(value string) (*Date, error)

func NewDate ¶

func NewDate(year, month, day int) (*Date, error)

func NewDateTime ¶ added in v0.10.0

func NewDateTime(year, month, day, hour, minute, second int) (*Date, error)

func (Date) Compare ¶

func (d Date) Compare(u Date) int

Compare compares the date instant d with u. If d is before u, it returns -1; if d is after u, it returns +1; if they're the same, it returns 0.

func (Date) Equal ¶

func (d Date) Equal(u Date) bool

func (*Date) IsWeekend ¶

func (d *Date) IsWeekend() bool

func (*Date) Time ¶

func (d *Date) Time() time.Time

type RangeEnd ¶ added in v0.10.0

type RangeEnd string

type RangeStart ¶ added in v0.10.0

type RangeStart string

Jump to

Keyboard shortcuts

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