Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrUnexpectedInput is returned when an input in the duration string does not match expectations ErrUnexpectedInput = errors.New("unexpected input") )
Functions ¶
This section is empty.
Types ¶
type Duration ¶
type Duration struct {
Years float64
Months float64
Weeks float64
Days float64
Hours float64
Minutes float64
Seconds float64
}
Duration holds all the smaller units that make up the duration
func Parse ¶
Parse attempts to parse the given duration string into a *Duration if parsing fails an error is returned instead
func (*Duration) ToTimeDuration ¶
ToTimeDuration converts the *Duration to the standard library's time.Duration note that for *Duration's with period values of a month or year that the duration becomes a bit fuzzy since obviously those things vary month to month and year to year I used the values that Google's search provided me with as I couldn't find anything concrete on what they should be
Click to show internal directories.
Click to hide internal directories.