Skip to content

Commit

Permalink
Replace sub-minute truncation with rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Lissé committed Apr 8, 2019
1 parent bb00132 commit c3561f9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion datetime/minutes.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func ParseMinutes(s string) (Minutes, error) {
return Minutes{}, err
}

return Minutes{duration: d.Truncate(time.Minute)}, nil
return Minutes{duration: d.Round(time.Minute)}, nil
}

func (m Minutes) Value() int {
Expand Down
2 changes: 1 addition & 1 deletion datetime/minutes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func Test_ParseMinutes(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, expected, actual)

actual, err = datetime.ParseMinutes("23m11s")
actual, err = datetime.ParseMinutes("22m33s")

assert.Nil(t, err)
assert.Equal(t, expected, actual)
Expand Down

0 comments on commit c3561f9

Please sign in to comment.