Repository navigation
fix(tools): report elapsed datetime differences across DST - #1239
Open
1828703450qqcom-ux wants to merge 1 commit into
Open
1828703450qqcom-ux wants to merge 1 commit into
1828703450qqcom-ux wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The built-in datetime tool's
diffaction can report wall-clock time for offset-free inputs in the same named timezone. Python subtraction ignores offset changes when both operands share the sametzinfo. In America/New_York, 01:30 to 03:30 on March 8, 2026 is one elapsed hour. The old code returned two.Change
Correct for the offset difference when Python uses shared-timezone arithmetic. The returned seconds, days, and display string all use the elapsed duration.
Verification
origin/main(d2f186d) on 2026-11-29. They pass with the fix.uv run --no-sync --extra dev pre-commit run --all-files --show-diff-on-failureandgit diff --check.Codex assisted with the investigation, implementation, and verification.