Awesome
approx
Package approx adds support for durations of days, weeks and years. The code used is from the go standard library. Only very minor adjustments were made to enable parsing to support extra units of time.
Usage
This really simple library allows you to normally use the time.Duration
object
from the go standard library, but suppliments two functions for handling
approximate time durations.
package main
import (
"fmt"
"github.com/goschtalt/approx"
)
func main() {
d, err := approx.ParseDuration("1w4d")
if err != nil {
panic(err)
}
fmt.Println(approx.String(d))
fmt.Println(d)
}