Skip to content

datetime.rst: correct timedelta description #101417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 2, 2024
Merged

Conversation

belm0
Copy link
Contributor

@belm0 belm0 commented Jan 30, 2023

It was confusingly claimed that timedelta could represent the difference between two datetime.time objects.

Subtraction of two datetime.time values is not allowed, nor can a timedelta be added to a time.

@bedevere-bot bedevere-bot added awaiting review docs Documentation in the Doc dir skip news labels Jan 30, 2023
@belm0
Copy link
Contributor Author

belm0 commented Feb 2, 2023

@abalkin I think it's another straightforward datetime correction-- would you take a look?

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Thank you for your contribution @belm0.

@serhiy-storchaka serhiy-storchaka added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Feb 2, 2024
@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) February 2, 2024 21:17
belm0 added 2 commits February 3, 2024 06:20
It was confusingly claimed that `timedelta` could represent the difference between two `datetime.time` objects.

Subtraction of two `datetime.time` values is not allowed, nor can a `timedelta` be added to a `time`.  And specifically, this conflicted text in the "timedelta Objects" section, stating "A timedelta object represents [...] the difference between two dates or times."
  * list `datetime` ahead of `date`, since it's more common when
    using `timedelta`
auto-merge was automatically disabled February 2, 2024 21:20

Head branch was pushed to by a user without write access

@belm0
Copy link
Contributor Author

belm0 commented Feb 2, 2024

I rebased-- please re-apply auto-merge and tag skip issue. Thank you @serhiy-storchaka

@serhiy-storchaka serhiy-storchaka merged commit 73d20ca into python:main Feb 2, 2024
@miss-islington-app
Copy link

Thanks @belm0 for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 2, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
(cherry picked from commit 73d20ca)

Co-authored-by: John Belmonte <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Feb 2, 2024

GH-114938 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Feb 2, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 2, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
(cherry picked from commit 73d20ca)

Co-authored-by: John Belmonte <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Feb 2, 2024

GH-114939 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Feb 2, 2024
serhiy-storchaka pushed a commit that referenced this pull request Feb 2, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
(cherry picked from commit 73d20ca)

Co-authored-by: John Belmonte <[email protected]>
serhiy-storchaka pushed a commit that referenced this pull request Feb 2, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
(cherry picked from commit 73d20ca)

Co-authored-by: John Belmonte <[email protected]>
@belm0 belm0 deleted the patch-3 branch February 2, 2024 22:10
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
It only represents the difference between two datetime or
date objects, not between two time objects.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants