Skip to content

fix: add days (d) unit support to parse_duration (fixes #1)#52

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

fix: add days (d) unit support to parse_duration (fixes #1)#52
jiangyj545 wants to merge 1 commit into
tine1117:mainfrom
jiangyj545:fix/parse-duration-days-support

Conversation

@jiangyj545

Copy link
Copy Markdown

Summary

The parse_duration function silently dropped the d (days) unit because the _UNITS dict was missing the entry, even though the regex _TOKEN already matched it.

Changes

  • Added "d": 86400 to the _UNITS dict in duration_utils.py
  • Updated comment to reflect days support
  • Added tests: test_days and test_days_combined

Verification

All 9 tests pass (7 original + 2 new).

Fixes #1

The _UNITS dict was missing 'd' entry despite the regex _TOKEN already
matching it. Added "d": 86400 to _UNITS and tests for days support.
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