Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Date ¶
Date represents a date without time information; it may represent only a year (month and day may be zero, comparisons work correctly in this case).
func ParseAllDates ¶
ParseAllDates returns a slice of Date objects found in the given string.
func ParseDate ¶
ParseDate parses a string and looks for the first thing in it that could be a date. If none are found, it returns a zero date. It also returns an index into the string pointing past the date that was found. If no date was found, the index is 0. The regex and logic are fairly finicky, which avoids lots of conditionals (perhaps at the expense of clarity).
func (Date) CompareTo ¶
CompareTo compares two date objects to an appropriate level of precision, and returns <0 if the receiver is less than other, >0 if it's greater than, and 0 if they're equal (at the level to which they can be compared). If one of the dates has different precision than the other, they are only compared to the lesser precision. An empty Date is considered to be less than any non-empty date and equal to itself.
func (Date) MarshalJSON ¶
MarshalJSON implements json.Marshaler