durafmt icon indicating copy to clipboard operation
durafmt copied to clipboard

:clock8: Better time duration formatting in Go!

Results 11 durafmt issues
Sort by recently updated
recently updated
newest added

Can you create a release for this project and follow [semantic versioning](https://semver.org/) please? It is ok to start with `v0` version to allow backward incompatible changes. So `v0.1.0` could be...

I think this is a common format: 10d 8h 32s ago Right now, it puts a space between the number and the unit.

enhancement

It would be nice to have nanosecond precision in a human readable duration format. Given [the following code,](https://play.golang.org/p/hm2_6Efzeph) there are still 784 nanoseconds that could be displayed in an output...

Since this prints: _9 years 46 weeks_ ```go durafmt.Parse(t).LimitFirstN(2).String() ``` I expected the `ParseShort()` function to print this way: _9y 46w_ ```go durafmt.ParseShort(t).LimitFirstN(2).String() ``` Am I missing something? If so,...

bug

New code, features has been added to durafmt, but at the cost of coverage which needs improving.

enhancement
help wanted
good first issue

Is there any interest for internationalised (non-English) duration formatting? I've created https://github.com/fat0troll/durufmt for Russian language, based on your library (thank you!), and I'm curious is there a need for fully-internationalised...

question

Hello, I would like to be able NOT to use multiple different time units, but only one. For example, instead of `3 seconds 123 milliseconds`, I'd like to get `3.123...

enhancement
good first issue

Carbon is a simple, semantic and developer-friendly golang package for datetime, it has been included by [awesome-go](https://github.com/avelino/awesome-go#date-and-time) https://github.com/golang-module/carbon

``` package main import ( "fmt" "github.com/hako/durafmt" ) func main() { str := "9999999s" units, _ := durafmt.DefaultUnitsCoder.Decode("年,周,天,时,分,秒,毫秒,微秒") duration, _ := durafmt.ParseString(str) fmt.Println(duration.Format(units)) //output: 16 周s 3 天s 17 时s...

I'd like a way to limit duration strings to the first N adjacent time units. Existing behaviour: ```go package main import ( "fmt" "time" "github.com/hako/durafmt" ) func main() { duration...