Skip to content

gh-116111: Clarify DST behaviour in datetime arithmetic and zoneinfo docs #137092

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

NehaJeevan
Copy link

@NehaJeevan NehaJeevan commented Jul 24, 2025

This PR updates the documentation for datetime and zoneinfo to clarify how arithmetic involving aware datetime objects behaves during daylight saving time (DST) transitions.

Changes include:

  • A .. warning:: in the timedelta section noting that arithmetic on aware datetime objects with the same tzinfo ignores DST.
  • A .. note:: in the datetime subtraction section, with a concrete example, explaining the "naive time" behavior.
  • A correction to the misleading sentence in zoneinfo.rst that previously claimed "no further intervention" was required to handle DST transitions.
  • A corresponding .. note:: in zoneinfo.rst to show how timedelta arithmetic skips DST transitions unless handled explicitly.

This PR resolves gh-116111 based on the suggestions on the issue


📚 Documentation preview 📚: https://cpython-previews--137092.org.readthedocs.build/

@python-cla-bot
Copy link

python-cla-bot bot commented Jul 24, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

Neha Jeevan added 2 commits July 25, 2025 18:39
@NehaJeevan NehaJeevan requested a review from cjw296 July 25, 2025 17:48
@StanFromIreland
Copy link
Member

Please do not use the Update Branch button unless necessary (e.g. fixing conflicts, jogging the CI, or very old PRs) as it uses valuable resources. For more information see the devguide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

datetime arithmetic during DST transitions is incorrect
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy