Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird behavior with end of DST and get_next method #25

Closed
jpinsolle-bc opened this issue Oct 3, 2022 · 1 comment
Closed

Weird behavior with end of DST and get_next method #25

jpinsolle-bc opened this issue Oct 3, 2022 · 1 comment

Comments

@jpinsolle-bc
Copy link

jpinsolle-bc commented Oct 3, 2022

Hello,

I got a weird behavior with the end of DST (Daily Saving Time) when croniter computes next occurrences.

With timezone Europe/Paris, at 2022-10-30T03:00:00+02:00, it will be 2022-10-30T02:00:00+01:00.
In this example, I simulate a date before the DST (midnight)

with freeze_time("2022-10-30T00:00:00+02:00"):
    now = datetime.now(tz=timezone.utc).astimezone(ZoneInfo("Europe/Paris"))
    cron = croniter("00 20 * * *", now)

    next1 = cron.get_next(datetime)
    next2 = cron.get_next(datetime)
    next3 = cron.get_next(datetime)
  
    print("Next1=", next1)
    print("Next2=", next2)
    print("Next3=", next3)

# Next1= 2022-10-30 20:00:00+01:00
# Next2= 2022-10-31 21:00:00+01:00  <-- 21H instead of 20H
# Next3= 2022-11-01 20:00:00+01:00

It seems the behavior come from this PR taichino/croniter#92

I think there is a bug, what is the expected result for this example ?

@jpinsolle-bc jpinsolle-bc changed the title Weird behavior with DST and get_next method Weird behavior with end of DST and get_next method Oct 3, 2022
@kiorky
Copy link
Owner

kiorky commented Oct 6, 2022

Exactly, it's a duplicate of #1 , you may see #1 (comment)

Thanks for the report !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants