taichino / croniter

croniter is a python module to provide iteration for datetime object.
http://github.com/taichino/croniter
387 stars 105 forks source link

Does not produce the correct output when the expression is something like (1-10/2 * * * *) #29

Closed ShamiliVK closed 7 years ago

ShamiliVK commented 10 years ago

In the croniter.py file, line 89 should be changed from: for j in xrange(int(low), int(high)+1): if j % int(step) == 0: e_list.append(j) To: for j in xrange(int(low), int(high)+1, int(step)):

if j % int(step) == 0:

     e_list.append(j)

Because, % returns intervals that are divisible by denominator between the start and end value whereas it should actually return start value plus the interval and next value should be result plus the interval and goes on.

After the change, the result will be like : [[1, 3, 5, 7, 9], [''], [''], [''], ['']]

josegonzalez commented 8 years ago

This is covered by https://github.com/taichino/croniter/commit/ff142916ab691b1caf5e2a569b199c69ca49a405.