github.com/go-chrono/chrono@v0.0.0-20240102183611-532f0d0d7c34/example_interval_test.go (about) 1 package chrono_test 2 3 import ( 4 "fmt" 5 6 "github.com/go-chrono/chrono" 7 ) 8 9 func ExampleParseInterval() { 10 i, _ := chrono.ParseInterval("R5/2007-03-01T13:00:00Z/P1Y2M10DT2H30M") 11 12 s, _ := i.Start() 13 p, d, _ := i.Duration() 14 e, _ := i.End() 15 16 fmt.Printf("start: %v; duration: %v; end: %v; repetitions: %v", s, chrono.FormatDuration(p, d), e, i.Repetitions()) 17 // Output: start: 2007-03-01 13:00:00Z; duration: P1Y2M10DT2H30M; end: 2008-05-11 15:30:00Z; repetitions: 5 18 }