Skip to content

Normalize bare dates in rruleset.rdate/exdate - #1663

Open
0718lol wants to merge 4 commits into
dateutil:masterfrom
0718lol:fix/rruleset-date-coercion
Open

0718lol wants to merge 4 commits into
dateutil:masterfrom
0718lol:fix/rruleset-date-coercion

Conversation

@0718lol

@0718lol 0718lol commented Nov 4, 2026 •

Copy link
Copy Markdown

Summary of changes

rruleset.rdate() and rruleset.exdate() accepted bare datetime.date
objects without complaint but raised
TypeError: can't compare datetime.datetime to datetime.date at iteration
time, while rrule silently converts a date dtstart to midnight. Parsing
real iCalendar data hits this because RFC 5545 permits DATE values for RDATE
and EXDATE (§3.8.5.1).

Both methods now normalize a bare date to midnight, the same conversion
rrule applies to dtstart. Per RFC 5545 §3.8.5.1 exclusion is by exact
DATE-TIME value, so a DATE-form EXDATE excludes the midnight instance of a
DATE-form DTSTART recurrence set — the common all-day-event case.

Open question for maintainers: #275 also discusses whether a DATE-form
EXDATE should exclude a whole day regardless of time. RFC 5545 §3.8.5.1
specifies exclusion by exact DATE-TIME value, so this PR follows that; a
whole-day reading would need separate tracking of DATE-form values and is
not attempted here.

Closes #275

Pull Request Checklist

  • Changes have tests
  • Authors have been added to AUTHORS.md
  • News fragment added in changelog.d. See CONTRIBUTING.md for details

Assisted-by: ZCode agent:GLM-5.3-Flash

rruleset.rdate() and rruleset.exdate() accepted bare datetime.date objects
without complaint but raised TypeError at iteration time, while rrule
converts a date dtstart to midnight. RFC 5545 permits DATE values for
RDATE and EXDATE, so parsing real iCalendar data hits this.

Both methods now normalize a bare date to midnight, the same conversion
rrule applies to dtstart.

Assisted-by: ZCode agent:GLM-5.3-Flash
@0718lol 0718lol closed this Nov 4, 2026
@0718lol 0718lol reopened this Nov 4, 2026
@0718lol 0718lol closed this Nov 4, 2026
@0718lol 0718lol reopened this Nov 4, 2026
@0718lol

0718lol commented Nov 4, 2026

Copy link
Copy Markdown
Author

CI triage: test (3.14t, macos-latest) / test (3.15t, macos-latest) failures

Both recent runs on this branch fail only in tests/test_tzpath_data.py::test_dst_matches_tzdata_zi[tzpath] (Africa/Casablanca and Africa/El_Aaiun far-future standard-offset mismatches). Evidence that this is unrelated to this PR's changes (which are limited to dateutil/rrule.py, tests/test_rrule.py, AUTHORS.md, changelog.d/):

  • In run 41887443716 (head 184b27e), the same test passes on macOS with CPython 3.12, 3.14 and pypy3.11, and on ubuntu/windows for every version; all four tz-* variant jobs (rearguard/vanguard/fat/slim) pass. Only the 3.14t macOS job fails.
  • The earlier run 41883598314 failed the same test on the 3.15t macOS job.
  • The Validate run on master (41277057784, 2026-11-01) passed every macOS job including 3.14t and 3.15t.
  • Locally on macOS arm64 (system tzdata 2026e-rearguard), the test passes on this exact head with CPython 3.12.15 and with a free-threaded CPython 3.14.8 build.

So the failure appeared between 2026-11-01 and 2026-11-04 and correlates with the free-threaded 3.14.10 / 3.15 pre-release interpreter builds or a runner image update, not with this diff. Posting for transparency — nothing in this PR touches dateutil/tz/.

@0718lol

0718lol commented Nov 4, 2026

Copy link
Copy Markdown
Author

Note on CI: the macOS jobs in the last few runs were cancelled by the
runner queue, and the one that ran (test (3.14t, macos-latest)) failed in
tests/test_tzpath_data.py::test_dst_matches_tzdata_zi[tzpath] — the
system-zoneinfo vs bundled-tzdata consistency check (Africa/Casablanca and
El_Aaiun far-future DST entries), which doesn't touch rrule and passes
locally on macOS. macos-latest master runs from 2026-11-01 were green, so
this looks like runner image tzdata drift rather than something introduced
here. All non-macOS checks pass on the current head.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

exdate and rdate fail if passed a date object, but dtstart does not.

1 participant