Repository navigation
Fix td_format rendering of negative durations (#72694) - #72774
Merged
potiuk merged 1 commit intoSep 9, 2026
Merged
Conversation
Signed-off-by: SHIVANSH-ux-ys <[email protected]>
ShivanshhhG
requested review from
amoghrajesh,
ashb and
potiuk
as code owners
September 9, 2026 05:27
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
Contributor
Backport successfully created: v3-3-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
potiuk
pushed a commit
that referenced
this pull request
Sep 9, 2026
…72774) (#72798) (cherry picked from commit 3e8f918) Signed-off-by: SHIVANSH-ux-ys <[email protected]> Co-authored-by: Shivansh Goel <[email protected]>
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.
closes: #72694
Rationale for this change
Fixes #72694.
td_formatinshared/timezonesrendered negativetimedeltaobjects as large positive durations (e.g.timedelta(seconds=-3752)rendered as29d:22h:57M:28s). This occurred becauserelativedeltadays normalization viadivmodproduced negative months (months=-1, days=+29) which were stripped by positive magnitude filtering (value < 1). Furthermore, numeric negative inputs (e.g.-3752) returned<1s.What changes are included in this PR?
td_formatinshared/timezones/src/airflow_shared/timezones/timezone.pyto extract negative sign prefix ("-") and compute duration string using the absolute magnitude of the timedelta or numeric duration.test_timezone.pyverifying negativetimedeltaand negative numeric inputs format correctly (e.g.td_format(timedelta(seconds=-3752))returns"-1h:2M:32s",td_format(-3752)returns"-1h:2M:32s",td_format(timedelta(days=-5))returns"-5d").Are these changes tested?
Yes. Added unit tests in
shared/timezones/tests/timezones/test_timezone.pyand verified all 30 timezone unit tests pass.