You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
parse() accepts malformed duration strings and applies leading "-" only to the first component #41
parse() returns numbers for malformed duration strings instead of throwing TypeError, and in negative compound durations like "-1h 30m" the leading - applies only to the first component.
Expected: "1.2.3s", "1 2h", "1hh", and "--1h" throw TypeError (matching the documented invalid-input behavior), and "-1h 30m" returns -5400000 (-90 minutes).
In src/index.ts, when SINGLE_RE does not match, PARSE_RE.exec(value) sums any <number><unit> substrings without checking that they cover the whole input, and evaluates signs per token rather than across the compound duration.
Versions: [email protected] and main (ae715e2d7d), Node.js v26.13.0.
Activity