kiorky / croniter

MIT License
410 stars 40 forks source link

Croniter skip month with 30 days when using "31,L" as day_of_month #89

Closed wilson-jw closed 1 month ago

wilson-jw commented 3 months ago

Test snippet:

expr = '0 0 31,L * *'
base = datetime.now()
_iter = croniter(expr, base)
for _ in range(12):
    print(_iter.get_next(datetime))

Result:

2024-08-31 00:00:00
2024-10-31 00:00:00
2024-12-31 00:00:00
2025-01-31 00:00:00
2025-03-31 00:00:00
2025-05-31 00:00:00
2025-07-31 00:00:00
2025-08-31 00:00:00
2025-10-31 00:00:00
2025-12-31 00:00:00
2026-01-31 00:00:00
2026-03-31 00:00:00

You can see that the above output not contains months with only 30 days, such as 2024-09-30. The 30th is the last day of September.

kiorky commented 1 month ago

Hello, AFAIK ,L in DOM means the 31 AND the last day of month, not any of the 31 of a month or the last day of any month.