Skip to content

Instantly share code, notes, and snippets.

@adewale
Last active June 1, 2016 03:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adewale/da804cc1db00c26e4892eb0da6463789 to your computer and use it in GitHub Desktop.
Save adewale/da804cc1db00c26e4892eb0da6463789 to your computer and use it in GitHub Desktop.
durafmt bug
package main
import (
"fmt"
"time"
"github.com/hako/durafmt"
)
func main() {
start := time.Date(2000, time.January, 1, 0,0,0,0,time.UTC)
end := time.Date(2001, time.January, 2, 0,0,0,0,time.UTC)
duration := end.Sub(start)
fmt.Println(duration)// 8808h0m0s
fmt.Println(durafmt.Parse(duration))
//Should print "1 day 1 year"
//Prints "1 year 1 month 3 days"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment