Last active
June 1, 2016 03:28
-
-
Save adewale/da804cc1db00c26e4892eb0da6463789 to your computer and use it in GitHub Desktop.
durafmt bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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