Closed perklet closed 5 years ago
For your code being timezone sensible, you need to make it explicitly hande it by setting it.
Please see https://github.com/taichino/croniter/blob/master/src/croniter/tests/test_croniter.py#L635 for an exemple
You can make pytz returns you your actual timezone by using:
import pytz # $ pip install pytz
from tzlocal import get_localzone # $ pip install tzlocal
# get local timezone
local_tz = get_localzone()
As you can see, my local timezone is Asia/Shanghai, the result timestamp is correct(assuming the cron expression is evaluated in UTC time), but when I use
datetime
as a parameter, the result does not consider timezone.Or maybe, should the cron expression be evaluated in local timezone? maybe we should add a timezone parameter to the
__init__
method?