Skip to content

Commit 7357f70

Browse files
authoredSep 23, 2024··
Merge pull request #45 from sg3-141-592/negative-step-check
Fix for negative step in cron expression
2 parents 28b4284 + 54c6452 commit 7357f70

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
 

‎gronx_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ func TestIsValid(t *testing.T) {
9191
if gron.IsValid("* * * *") {
9292
t.Errorf("expected false, got true")
9393
}
94+
if gron.IsValid("0-0/-005 * * * *") {
95+
t.Errorf("expected true, got false")
96+
}
9497
})
9598

9699
}

‎validator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func inStep(val int, s string, bounds []int) (bool, error) {
1414
if err != nil {
1515
return false, err
1616
}
17-
if step == 0 {
17+
if step <= 0 {
1818
return false, errors.New("step can't be 0")
1919
}
2020

0 commit comments

Comments
 (0)
Please sign in to comment.