Given this program:
from datetime import datetime
from dateutil import tz
from dateutil.rrule import DAILY, rrule
tzinfo = tz.tz.gettz('America/New_York')
dt = datetime(2025, 3, 7, 2, 30, 0, tzinfo=tzinfo)
for dt in rrule(DAILY, dtstart=dt, count=5):
print(dt)
Running it like so produces this output:
$ uv run --with python-dateutil mre.py
2025-03-07 02:30:00-05:00
2025-03-08 02:30:00-05:00
2025-03-09 02:30:00-04:00
2025-03-10 02:30:00-04:00
2025-03-11 02:30:00-04:00
But 2025-03-09 02:30:00-04:00 is not a valid datetime for America/New_York, since that's when the East coast entered DST.
RFC 5545 seems to require that these datetimes are totally ignored:
Recurrence rules may generate recurrence instances with an invalid date (e.g., February 30) or nonexistent local time (e.g., 1:30 AM on a day where the local time is moved forward by an hour at 1:00 AM). Such recurrence instances MUST be ignored and MUST NOT be counted as part of the recurrence set.
So I think I'd expect this as output:
2025-03-07 02:30:00-05:00
2025-03-08 02:30:00-05:00
2025-03-10 02:30:00-04:00
2025-03-11 02:30:00-04:00
2025-03-12 02:30:00-04:00
Given this program:
Running it like so produces this output:
But
2025-03-09 02:30:00-04:00is not a valid datetime forAmerica/New_York, since that's when the East coast entered DST.RFC 5545 seems to require that these datetimes are totally ignored:
So I think I'd expect this as output: