Skip to content

fix: add days (d) unit support to parse_duration#51

Open
qyu450724-source wants to merge 1 commit into
tine1117:mainfrom
qyu450724-source:fix/add-days-unit-to-parse-duration
Open

fix: add days (d) unit support to parse_duration#51
qyu450724-source wants to merge 1 commit into
tine1117:mainfrom
qyu450724-source:fix/add-days-unit-to-parse-duration

Conversation

@qyu450724-source

Copy link
Copy Markdown

Summary

The parse_duration function was missing support for the days (d) unit, despite the regex pattern already matching it in [wdhms].

Changes

  • Added "d": 86400 to the _UNITS dictionary so that parse_duration("1d") correctly returns 86400
  • Updated the comment to reflect the new supported units list
  • Added 4 new test cases:
    • test_days: 1d -> 86400
    • test_days_multiple: 3d -> 259200
    • test_days_combined_with_hours: 2d4h -> 187200
    • test_full_combined: 1w2d3h4m5s -> 788645

All 11 tests pass.

Fixes #1

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