📚 approx - Awesome Go Library for Date and Time
A Duration extension supporting parsing/printing durations in days, weeks and years.
🏷️ Date and Time
📂 Libraries for working with dates and times.
⭐ 12 stars
Detailed Description of approx
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)
}