An open API service indexing awesome lists of open source software.

https://github.com/fortio/duration

Duration output and input with days and weeks in go
https://github.com/fortio/duration

days duration go golang

Last synced: 24 days ago
JSON representation

Duration output and input with days and weeks in go

Awesome Lists containing this project

README

          

[![GoDoc](https://godoc.org/fortio.org/duration?status.svg)](https://pkg.go.dev/fortio.org/duration)
[![Go Report Card](https://goreportcard.com/badge/fortio.org/duration)](https://goreportcard.com/report/fortio.org/duration)
[![CI Checks](https://github.com/fortio/duration/actions/workflows/include.yml/badge.svg)](https://github.com/fortio/duration/actions/workflows/include.yml)
[![codecov](https://codecov.io/github/fortio/duration/graph/badge.svg?token=Yx6QaeQr1b)](https://codecov.io/github/fortio/duration)

# duration

A zero dependency library to overcome issues with lack of days and weeks in standard library's duration as well as ease parsing for common date/times and print durations without zeroes (eg `1d3m` instead of `24h3m0s`) - it originated in [tclock](https://github.com/fortio/tclock) and is available also via [dflag](https://github.com/fortio/dflag) for dynamic flag (includes regular duration.Flag for simple flags parsing with new duration in days and weeks).

See the [godoc](https://pkg.go.dev/fortio.org/duration) for examples and more details.

See also [golang/go#74813]

# Usage

import `fortio.org/duration` and go mod tidy, or

```
go get fortio.org/duration@latest
```