Skip to content

fix: add days (d) unit to parse_duration - #117

Open
xaiksan1 wants to merge 1 commit into
tine1117:mainfrom
xaiksan1:fix/1-parse-duration-days
Open

xaiksan1 wants to merge 1 commit into
tine1117:mainfrom
xaiksan1:fix/1-parse-duration-days

Conversation

@xaiksan1

@xaiksan1 xaiksan1 commented Aug 3, 2026

Copy link
Copy Markdown

The README lists d as a supported unit but the parser silently dropped it, returning 0 for 1d and wrong results for compound durations like 2d4h.

Fix: added d: 86400 to the _UNITS dict in duration_utils.py.

Tests added:

  • test_days: verifies 1d == 86400, 2d == 172800
  • test_combined_with_days: verifies 2d4h == 187200 and 1w2d3h4m5s == 788645

All 9 tests pass.

Closes #1

The README lists 'd' as a supported unit but the parser silently
dropped it, returning 0 for '1d' and wrong results for compound
durations like '2d4h'. Added 'd' = 86400 seconds to _UNITS and
added test coverage for days and combined durations.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parse_duration drops the days (d) unit

1 participant