This library provides facilities for parsing and formatting durations as described by RFC3339 which describes a specific encoding for ISO8601 dates, times, and time periods.
Example usage:
dur, _ := duration.ParseRFC3339("P3Y6M4DT12H30M5S")
fmt.Println(dur.AddToTime(time.Now())) // e.g. 2023-09-07 07:49:20.272082206 -0500 CDT
fmt.Println(dur.FormatRFC3339()) // P3Y6M4DT12H30M5S
See package documentation for usage and more examples.