Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Date_dashed_yyyymmdd is the date format for "YYYY-MM-DD" Date_dashed_yyyymmdd = &DateFormat{"YYYY-MM-DD", "2006-01-02"} )
View Source
var ErrInvalidDate = errors.New("invalid date")
ErrInvalidDate is returned when trying to validate and/or parse a date string, there was no success.
This might happen because of two reasons: 1. Date string is actually invalid 2. Format of the date string is not supported
Functions ¶
This section is empty.
Types ¶
type DateFormat ¶
type DateFormat struct {
// contains filtered or unexported fields
}
DateFormat is a wrapper to hold the golang layout used to parse dates and a display value that can be used to be shown to users to explain the format it represents
type Dater ¶
type Dater interface { // Now returns the current local time Now() *time.Time // Parse parses a formatted string and returns the time value it represents Parse(format *DateFormat, value string) (*time.Time, error) // ParseAll tries to parse a formatted string by passing it through all // supported date layouts and returns the time valye it represents ParseAll(value string) (*time.Time, error) }
Dater is a wrapper to handle date operations
This is useful for testing
Click to show internal directories.
Click to hide internal directories.