Skip to content

Commit

Permalink
Fix: exclude window feature for single-digit minute values (#5266)
Browse files Browse the repository at this point in the history
Fix exclude window handling for single-digit minute values

Co-authored-by: Gesing, Simon <[email protected]>
  • Loading branch information
Xeimn and Xeimn authored Nov 14, 2024
1 parent 288a5f3 commit 9210805
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion utils/timeutil/timeutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ func Now() time.Time {
func GetElapsedMinsInThisDay(currentTime time.Time) int {
hour := currentTime.Hour()
minute := currentTime.Minute()
return MinsOfDay(fmt.Sprintf("%d:%d", hour, minute))
return MinsOfDay(fmt.Sprintf("%02d:%02d", hour, minute))
}
6 changes: 6 additions & 0 deletions warehouse/router/scheduling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ func TestRouter_CanCreateUpload(t *testing.T) {
windowEnd: "06:00",
expectedValue: true,
},
{
currentTime: time.Date(2009, time.November, 10, 5, 05, 0, 0, time.UTC),
windowStart: "05:00",
windowEnd: "06:00",
expectedValue: true,
},
{
currentTime: time.Date(2009, time.November, 10, 5, 30, 0, 0, time.UTC),
windowStart: "22:00",
Expand Down

0 comments on commit 9210805

Please sign in to comment.