taichino / croniter

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

Return repeated timestamps #106

Closed kr2 closed 5 years ago

kr2 commented 6 years ago

I think this is related to #96.

The following fails at 2019-03-31 01:00:00+01:00 when going from winter- to summer-time? I know the value should be 0-59 but it passes as valid.

import datetime
import dateutil
from croniter import croniter

TZ = dateutil.tz.gettz('Europe/Berlin')
start_time = datetime.datetime(year=2018, month=5, day=10, hour=0, minute=0, second=0, microsecond=0, tzinfo=TZ)
cron = '*/60 * * * *'
print('chron string is valid:', croniter.is_valid(cron))
_iter = croniter(expr_format=cron, start_time=start_time, ret_type=datetime.datetime, day_or=True)
last = next(_iter)
i = 0
for current in _iter:
    if last == current:
        print('fail', i, current)
        break
    last = current
    i += 1

Output:

chron string is valid: True
fail 7799 2019-03-31 01:00:00+01:00
kiorky commented 5 years ago

already fixed it seems, i forgot to close this tied bug.