Skip to content

fix datetimes and dates are not substitutable #4342 - #4466

Open
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:4342
Open

fix datetimes and dates are not substitutable #4342#4466
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:4342

Conversation

@asukaminato0721

@asukaminato0721 asukaminato0721 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #4342

Ordered date/datetime comparisons now report unsupported-operation in either operand order.
Equality and same-type ordering remain valid.

Test Plan

add test

@meta-cla meta-cla Bot added the cla signed label Aug 6, 2026
@github-actions github-actions Bot added the size/s label Aug 6, 2026
@meta-codesync

meta-codesync Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D115051490. (Because this pull request was imported automatically, there will not be any future comments.)

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Diff from mypy_primer, showing the effect of this PR on open source code:

core (https://github.com/home-assistant/core)
+ ERROR homeassistant/components/habitica/calendar.py:251:28-73: `<` is not supported between `datetime` and `date` [unsupported-operation]
+ ERROR homeassistant/components/lamarzocco/calendar.py:101:20-46: `<` is not supported between `date` and `datetime` [unsupported-operation]
+ ERROR homeassistant/components/lamarzocco/calendar.py:103:20-46: `>` is not supported between `date` and `datetime` [unsupported-operation]
+ ERROR homeassistant/components/radarr/coordinator.py:178:20-47: `>=` is not supported between `datetime` and `date` [unsupported-operation]
+ ERROR homeassistant/components/radarr/coordinator.py:194:16-69: `>=` is not supported between `datetime` and `date` [unsupported-operation]
+ ERROR homeassistant/components/sonarr/calendar.py:68:51-66: `>` is not supported between `date` and `datetime` [unsupported-operation]
+ ERROR homeassistant/components/workday/calendar.py:95:43-77: `>=` is not supported between `datetime` and `date` [unsupported-operation]
+ ERROR homeassistant/components/workday/calendar.py:105:16-69: `<=` is not supported between `date` and `datetime` [unsupported-operation]
+ ERROR homeassistant/components/workday/calendar.py:105:16-69: `<=` is not supported between `datetime` and `date` [unsupported-operation]

@asukaminato0721 asukaminato0721 changed the title fix fix datetimes and dates are not substitutable #4342 Aug 6, 2026
@yangdanny97

Copy link
Copy Markdown
Contributor

are the added primer errors false positives?

@asukaminato0721

Copy link
Copy Markdown
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

datetimes and dates are not substitutable

3 participants