Go Durations easily parse string durations without any order in input order and high durations like 1 year.
I was looking for parser with out any order on string, easy to use, support long term durations such as year, month. I couldn't find so I created one.
Duration, Err := GetDuration("1mon 1w 1h 1m 1s")
Duration, Err := GetDuration("1h 1w 1m 1y")
Durations | short | Package |
---|---|---|
Nanosecond | ns | Time.Time |
Microsecond | us & µs & μs | Time.Time |
Millisecond | ms | Time.Time |
Second | s | Time.Time |
Minute | m | Time.Time |
Hour | h | Time.Time |
Day | d | durations |
Week | w | durations |
Month | mon | durations |
Year | y | durations |
Century | c | durations |