File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ func HumanDuration(d time.Duration) string {
2626 return fmt .Sprintf ("%d hours" , hours )
2727 } else if hours < 24 * 7 * 2 {
2828 return fmt .Sprintf ("%d days" , hours / 24 )
29- } else if hours < 24 * 30 * 3 {
29+ } else if hours < 24 * 30 * 2 {
3030 return fmt .Sprintf ("%d weeks" , hours / 24 / 7 )
3131 } else if hours < 24 * 365 * 2 {
3232 return fmt .Sprintf ("%d months" , hours / 24 / 30 )
Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ func TestHumanDuration(t *testing.T) {
7171 assertEquals (t , "4 weeks" , HumanDuration (1 * month ))
7272 assertEquals (t , "6 weeks" , HumanDuration (1 * month + 2 * week ))
7373 assertEquals (t , "8 weeks" , HumanDuration (2 * month ))
74+ assertEquals (t , "2 months" , HumanDuration (2 * month + 2 * week ))
7475 assertEquals (t , "3 months" , HumanDuration (3 * month + 1 * week ))
7576 assertEquals (t , "5 months" , HumanDuration (5 * month + 2 * week ))
7677 assertEquals (t , "13 months" , HumanDuration (13 * month ))
You can’t perform that action at this time.
0 commit comments