Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions duration_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Seconds per unit. Supported: weeks, hours, minutes, seconds.
_UNITS = {
"w": 604800,
"d": 86400,
"h": 3600,
"m": 60,
"s": 1,
Expand All @@ -21,6 +22,7 @@ def parse_duration(text: str) -> int:
Examples:
parse_duration("1h30m") -> 5400
parse_duration("1w") -> 604800
parse_duration("2d4h") -> 187200

Raises ValueError on empty or malformed input.
"""
Expand Down