Skip to content

[v4.0.0a4] Combining daily and weekly triggers increments by 14 days #911

Description

@bmeares

Things to check first

  • I have checked that my issue does not already have a solution in the FAQ

  • I have searched the existing issues and didn't find my bug already reported there

  • I have checked that my bug is still present in the latest release

Version

v4.0.0a4

What happened?

Combing daily and weekly triggers (or days=7) skips every other interval, firing every 14 days. The same behavior is observed with different timezones and threshold values.

How can we reproduce the bug?

from datetime import datetime, timezone
from apscheduler.triggers.combining import AndTrigger
from apscheduler.triggers.interval import IntervalTrigger

start_dt = datetime(2024, 5, 1, tzinfo=timezone.utc)
daily_trigger = IntervalTrigger(days=1, start_time=start_dt)
weekly_trigger = IntervalTrigger(weeks=1, start_time=start_dt)
and_trigger = AndTrigger([daily_trigger, weekly_trigger])

and_trigger.next()
# datetime.datetime(2024, 5, 1, 0, 0, tzinfo=datetime.timezone.utc)
and_trigger.next()
# datetime.datetime(2024, 5, 15, 0, 0, tzinfo=datetime.timezone.utc)
and_trigger.next()
# datetime.datetime(2024, 5, 29, 0, 0, tzinfo=datetime.timezone.utc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions