Skip to content

Commit

Permalink
Fix after method for Time
Browse files Browse the repository at this point in the history
  • Loading branch information
ribice committed Jun 24, 2020
1 parent d4845a9 commit 86ef269
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions time.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ func (t Time) After(tm Time) bool {
if t.Hour > tm.Hour {
return true
}
if t.Hour < tm.Hour{
return false
}
return t.Minute > tm.Minute
}

Expand Down
6 changes: 6 additions & 0 deletions time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ func TestAfter(t *testing.T) {
t2: Time{23, 59, true},
isAfter: false,
},
{
name: "Before",
t1: Time{11, 59, true},
t2: Time{23, 59, true},
isAfter: false,
},
}
for _, tt := range cases {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 86ef269

Please sign in to comment.