Documentation
¶
Index ¶
- Constants
- Variables
- func Calculate(year int) time.Time
- func DaysInMonth(year int, month int) int
- func DaysInMonthByDate(t time.Time) int
- func DaysInMonthList(year int, month int) []int
- func GetDate(year, month, day int) time.Time
- func GetEaster(year int) time.Time
- func GetGoodFriday(year int) time.Time
- func GetMonday(year int) time.Time
- type DateTime
- func (d *DateTime) After(u Interface) bool
- func (d *DateTime) Before(u Interface) bool
- func (d *DateTime) Between(start, end Interface) bool
- func (d *DateTime) Compare(u Interface) int
- func (d *DateTime) Equal(u Interface) bool
- func (d *DateTime) FromString(value string) (Interface, error)
- func (d *DateTime) IsWeekend() bool
- func (d *DateTime) Time() time.Time
- func (d *DateTime) ToString() string
- type Historic
- type HistoricDate
- type Interface
- type Range
- func NewRange(from, to string, start RangeStart, end RangeEnd) (*Range, error)
- func NewRangeOptional(from, to string) (*Range, error)
- func NewRangeStartOptional(from, to string) (*Range, error)
- func NewRangeStartStrict(from, to string) (*Range, error)
- func NewRangeStrict(from, to string) (*Range, error)
- func RangeFromString(value string) (*Range, error)
- type RangeEnd
- type RangeInterface
- type RangeStart
- type Value
- type ValueInterface
Constants ¶
View Source
const ( YearRegexp = `(\d+)` MonthRegexp = `(0[1-9]|1[0-2])` DayRegexp = `(0[1-9]|[12][0-9]|3[01])` HourRegexp = `(0[0-9]|1[0-9]|2[0-3])` MinuteRegexp = `[0-5][0-9]` SecondRegexp = `[0-5][0-9]` DateRegexp = YearRegexp + `-` + MonthRegexp + `-` + DayRegexp TimeRegexp = `(` + HourRegexp + `):(` + MinuteRegexp + `):(` + SecondRegexp + `)` DateTimeRegexp = `((` + DateRegexp + `) (` + TimeRegexp + `))` RangeRegexp = `^([\[\(])` + DateTimeRegexp + `?\s*,\s*` + DateTimeRegexp + `?([\]\)])$` )
View Source
const (
Regexp = `^((\d+)-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01]))\s(0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$`
)
Variables ¶
View Source
var ( // RangeStartStrict can not be equal RangeStartStrict RangeStart = "[" // RangeStartOptional can be equal RangeStartOptional RangeStart = "(" // RangeEndStrict can not be equal RangeEndStrict RangeEnd = "]" // RangeEndOptional can be equal RangeEndOptional RangeEnd = ")" )
Functions ¶
func DaysInMonth ¶
func DaysInMonthByDate ¶
func DaysInMonthList ¶ added in v0.10.0
func GetGoodFriday ¶
Types ¶
type DateTime ¶ added in v1.0.0
type DateTime 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 (*DateTime) Compare ¶ added in v1.0.0
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 (*DateTime) FromString ¶ added in v1.0.0
type HistoricDate ¶ added in v1.0.0
type HistoricDate struct {
// contains filtered or unexported fields
}
type Interface ¶ added in v1.0.0
type Interface interface { ToString() string FromString(value string) (Interface, error) Time() time.Time Equal(u Interface) bool Between(start, end Interface) bool Before(u Interface) bool After(u Interface) bool Compare(u Interface) int }
func FromString ¶ added in v1.0.0
type Range ¶ added in v1.0.0
type Range struct {
// contains filtered or unexported fields
}
func NewRange ¶ added in v1.0.0
func NewRange(from, to string, start RangeStart, end RangeEnd) (*Range, error)
func NewRangeOptional ¶ added in v1.0.0
func NewRangeStartOptional ¶ added in v1.0.0
func NewRangeStartStrict ¶ added in v1.0.0
func NewRangeStrict ¶ added in v1.0.0
func RangeFromString ¶ added in v1.0.0
func (*Range) From ¶ added in v1.0.0
func (r *Range) From() ValueInterface
func (*Range) Start ¶ added in v1.0.0
func (r *Range) Start() RangeStart
func (*Range) To ¶ added in v1.0.0
func (r *Range) To() ValueInterface
type RangeInterface ¶ added in v1.0.0
type RangeInterface interface { Start() RangeStart End() RangeEnd From() ValueInterface To() ValueInterface String() string Is(value any) bool }
type ValueInterface ¶ added in v1.0.0
type ValueInterface interface {
Date() Interface
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.