BigDuration represents a duration in years (365 days), months (30 days), weeks and days alongside stadard time.Duration that can be parsed from hours, minutes and seconds.
ParseBigDuration parses a BigDuration string simply splitting by keyword and then using time.ParseDuration for smaller units
bd, _ := bigduration.ParseBigDuration("1year2month1day5h10s") duration := bd.Duration() // convert to time.Duration fmt.Println(duration)
Add returns the sum of both big durations
Compact returns a string representation compacting smaller units into bigger ones when possible
Duration returns equivalent time.Duration
From takes a time and returns the time adding the big duration in a calendar sensitive way months are no longer 30 days but calendar months instead, leap years also accounted for.
MarshalJSON implements the json.Marshaler interface.
String returns a string representing the duration in the form "2month23days2h3m0.5s". Leading zero units are omitted.
UnmarshalJSON implements the json.Unmarshaler interface.
Until takes a time and returns the time subtracting the big duration in a calendar sensitive way months are no longer 30 days but calendar months instead, leap years also accounted for.