Skip to content

Commit bd5db65

Browse files
author
Ulrich Lissé
committed
Remove trailing seconds from Minutes string representation
1 parent 1c1931e commit bd5db65

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

datetime/minutes.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package datetime
22

33
import (
44
"math"
5+
"strings"
56
"time"
67
)
78

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

2930
func (m Minutes) String() string {
30-
return m.duration.String()
31+
return strings.TrimSuffix(m.duration.String(), "0s")
3132
}

datetime/minutes_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestMinutes_Value(t *testing.T) {
3030
}
3131

3232
func TestMinutes_String(t *testing.T) {
33-
expected := "23m0s"
33+
expected := "23m"
3434
actual := datetime.NewMinutes(23).String()
3535

3636
assert.Equal(t, expected, actual)

0 commit comments

Comments
 (0)