Skip to content

Commit

Permalink
Remove trailing seconds from Minutes string representation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Lissé committed Apr 8, 2019
1 parent 1c1931e commit bd5db65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion datetime/minutes.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package datetime

import (
"math"
"strings"
"time"
)

Expand All @@ -27,5 +28,5 @@ func (m Minutes) Value() int {
}

func (m Minutes) String() string {
return m.duration.String()
return strings.TrimSuffix(m.duration.String(), "0s")
}
2 changes: 1 addition & 1 deletion datetime/minutes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestMinutes_Value(t *testing.T) {
}

func TestMinutes_String(t *testing.T) {
expected := "23m0s"
expected := "23m"
actual := datetime.NewMinutes(23).String()

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

0 comments on commit bd5db65

Please sign in to comment.