Skip to content

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

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

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

Conversation

@WNordbergg

Copy link
Copy Markdown

Fixes #120

Problem

parse_duration silently dropped day (d) values: the token regex accepted d but _UNITS had no entry for it, so parse_duration("1d") returned 0.

Change

  • Added "d": 86400 to _UNITS in duration_utils.py
  • Regression tests: test_days (1d -> 86400) and test_days_combined (2d12h -> 216000)

Verification

Full suite: 9 tests, all passing (7 pre-existing + 2 new).

The _UNITS dict was missing the entry for days while the token regex
already accepted 'd', so day values were silently dropped.

- add "d": 86400 to _UNITS
- regression tests: test_days, test_days_combined
@WNordbergg WNordbergg closed this by deleting the head repository Sep 2, 2026
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.

1 participant