Skip to content

fix: add missing 'd' (days) unit to parse_duration#74

Open
ellitedom03 wants to merge 1 commit into
tine1117:mainfrom
ellitedom03:fix/add-days-unit
Open

fix: add missing 'd' (days) unit to parse_duration#74
ellitedom03 wants to merge 1 commit into
tine1117:mainfrom
ellitedom03:fix/add-days-unit

Conversation

@ellitedom03

Copy link
Copy Markdown

Fix

The 'd' (days) unit was accepted by the token regex but missing from the _UNITS dictionary, causing parse_duration to silently return 0 for day values.

Changes

  • Added 'd': 86400 to _UNITS dict
  • Added test_days() and test_days_combined() tests

Verification

All 9 tests pass:

test_days PASSED — parse_duration('1d') == 86400
test_days_combined PASSED — parse_duration('2d4h') == 187200

Closes #1

The 'd' character was accepted by the token regex but never added to
the _UNITS dictionary, causing parse_duration to silently return 0 for
day values instead of counting them as 86400 seconds.

Added 'd': 86400 to _UNITS and tests for single and combined day parsing.

Closes tine1117#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