Documentation ¶
Overview ¶
Package timex contained time-related extensions, notably representations of a Date without a time, and a MonthYear without a day.
Index ¶
- func MonthsBetween(from, to MonthYear) int
- func MustParseTime(layout, s string) time.Time
- type Date
- func (d Date) After(other Date) bool
- func (d Date) Before(other Date) bool
- func (d Date) CompareTo(other Date) int
- func (d Date) DayEnd() time.Time
- func (d Date) DayStart() time.Time
- func (d Date) Equal(other Date) bool
- func (d Date) IsZero() bool
- func (d Date) Less(other Date) bool
- func (d Date) NextDay() Date
- func (d Date) String() string
- func (d *Date) UnmarshalText(text []byte) error
- type MonthYear
- func (my MonthYear) After(other MonthYear) bool
- func (my MonthYear) Before(other MonthYear) bool
- func (my MonthYear) CompareTo(other MonthYear) int
- func (my MonthYear) Equal(other MonthYear) bool
- func (my MonthYear) IsZero() bool
- func (my MonthYear) Less(other MonthYear) bool
- func (my MonthYear) MonthEnd() Date
- func (my MonthYear) MonthStart() Date
- func (my MonthYear) NextMonth() MonthYear
- func (my MonthYear) String() string
- func (my *MonthYear) UnmarshalText(text []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MonthsBetween ¶
MonthsBetween returns the number of months between two (month, year)
func MustParseTime ¶
MustParseTime parses the given string according to the provided layout, panicking if the time cannot be parsed. Useful for tests.
Types ¶
type Date ¶
A Date is a month, day, year.
func MustParseDate ¶
MustParseDate parses a date, panicking if the date can't be parsed. Useful for tests.
func (*Date) UnmarshalText ¶
UnmarshalText unmarshalls the date from a text value. Implements the TextUnmarshaler interface.
type MonthYear ¶
MonthYear is a month and year combination.
func MustParseMonthYear ¶
MustParseMonthYear parses a month-year, panicking if the month-year cannot be parsed. Useful for tests.
func ParseMonthYear ¶
ParseMonthYear parses a month-year.
func (MonthYear) CompareTo ¶
CompareTo compares two (month, year). Returns:
-1 if this MonthYear is earlier than the provided MonthYear 1 if this MonthYear is later than the provided MonthYear 0 if this MonthYear is the same as the provided MonthYear
func (MonthYear) MonthStart ¶
MonthStart returns the date that is the start of the month.
func (*MonthYear) UnmarshalText ¶
UnmarshalText unmarshalls the date from a text value. Implements the TextUnmarshaler interface.