Documentation ¶
Overview ¶
Package duration handles ISO8601-formatted durations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Duration ¶
Duration represents an ISO8601 Duration https://en.wikipedia.org/wiki/ISO_8601#Durations
func ParseISO8601 ¶
ParseISO8601 parses an ISO8601 duration string.
func (Duration) HasTimePart ¶
HasTimePart returns true if the time part of the duration is non-zero.
func (Duration) MarshalJSON ¶
MarshalJSON satisfies json.Marshaler.
func (Duration) Shift ¶
Shift returns a time.Time, shifted by the duration from the given start.
NB: Shift uses time.AddDate for years, months, weeks, and days, and so shares its limitations. In particular, shifting by months is not recommended unless the start date is before the 28th of the month. Otherwise, dates will roll over, e.g. Aug 31 + P1M = Oct 1.
Week and Day values will be combined as W*7 + D.
func (Duration) ToTimeDuration ¶
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON satisfies json.Unmarshaler.