Documentation ¶
Index ¶
- func DatesDaysCompare(high, low *Date) (int, error)
- type Date
- func (d Date) After(u Date) bool
- func (d Date) AfterOrEqual(u Date) bool
- func (d Date) Before(u Date) bool
- func (d Date) BeforeOrEqual(u Date) bool
- func (d Date) Equal(u Date) bool
- func (d Date) FormatToDashYYYYMMDD() string
- func (d Date) FormatToShort() string
- func (d Date) FormatToSlashDDMMYYYY() string
- func (d Date) MarshalJSON() ([]byte, error)
- func (d Date) Time() (time.Time, error)
- func (d *Date) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DatesDaysCompare ¶
DatesDaysCompare returns an in
Types ¶
type Date ¶
type Date struct {
// contains filtered or unexported fields
}
Date is a formatted time which contemplates days, months and years. Provides methods to parse from and to other formats and has Before, After... kind of operations. Unmarshals methods will work with "2006-01-02" formatted times.
Zero value Date is Jesus birthday: 0001-01-01
func DateFromDashYYYYMMDDFormat ¶
DateFromDashYYYYMMDDFormat builds a Date from a 2006-01-02 formatted time with no format validation. For format validations use the safe version (which is 100 times slower)
func DateFromDashYYYYMMDDFormatSafe ¶
DateFromDashYYYYMMDDFormatSafe builds a Date from a 2006-01-02 formatted time validating the input This is 100 times slower than the unsafe version
func DateFromShortFormat ¶
DateFromShortFormat builds a Date from a 060102 formatted time
func DateFromSlashDDMMYYYYFormat ¶
DateFromSlashDDMMYYYYFormat builds a Date from a 02/01/2006 formatted time
func (Date) AfterOrEqual ¶
AfterOrEqual evaluates if this date is after or equals to u
func (Date) BeforeOrEqual ¶
BeforeOrEqual evaluates if this date is before or equals to u
func (Date) FormatToDashYYYYMMDD ¶
FormatToDashYYYYMMDD formats the Date to 2006-01-02 format
func (Date) FormatToShort ¶
FormatToShort formats the Date to 060102 format
func (Date) FormatToSlashDDMMYYYY ¶
FormatToSlashDDMMYYYY formats a Date to 02/01/2006 format
func (Date) MarshalJSON ¶
MarshalJSON supports json.Marshaler interface. Marshals to a "2006-01-02" formatted string
func (Date) Time ¶
Time returns the 'time.Time' value corresponding to a Date. Note that hours of 'Time' will always be 0 since a Date only arranges from year to day
func (*Date) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshal interface. Expects a "2006-01-02" formatted string