Breaking
- Require Node.js 22 d4f7c61
- Ignore
unitCountwithcolonNotationcc2326c- Dropping a field from the right changed what the remaining fields meant:
3661000withunitCount: 2was1:01, which reads as 1 minute and 1 second. It is now1:01:01.
- Dropping a field from the right changed what the remaining fields meant:
- Always show the hours with
colonNotationandhideSecondsc501a7060000was a bare1. It is now0:01, so the fields always read ash:mm.
- Pad the days to 3 digits with
colonNotationafter a year c77bbd01:05:00:00:00is now1:005:00:00:00, so the width does not change between 9 and 100 days.
- The output changed for many edge cases (see the fixes below). It's probably not breaking for most users, but if you depend on the exact output, for example, in unit tests, the output might have changed slightly.
Improvements
- Remove the
parse-msdependency 4cdc911 - Remove float noise from fractional input 4cdc911
- A fractional number is now read to 15 significant digits, so
999.9999999999999is1s, not999ms. An integer (numberorbigint) is exact at any size. Learn more.
- A fractional number is now read to 15 significant digits, so
Fixes
- Fix fractional seconds rounding up into the next unit (#76) 0127f97 614a6ec
1999.999999was2s, and59999.999999was60s. They are now1.9sand59.9s.
- Fix the seconds losing precision for large durations and high digit counts 34b9a49 c0c8ec5 1ce8d2d
40176002900withsecondsDecimalDigits: 2was1y 100d 2.89s. It is now1y 100d 2.90s.
- Fix the days, hours, and minutes for very large durations fa0e801
1e22showed18h 36minstead of17h 46m.
- Fix the sub-millisecond fields a7dc168 7a2453a 29a30b3
0.00397withformatSubMillisecondswas3µs 969ns, and1234567890123showed a phantom64ns.
- Round the decimal milliseconds half up correctly c1f30cb
1.005withmillisecondsDecimalDigits: 2was1.00ms. It is now1.01ms.
- Never show a nonzero duration as
0ms124a6ee 8b2dff2 - Never show a negative zero, like
-0ms2727b38 - Fix
hideSecondsshowing0msfor a duration under a minute 618aae945000is now45s, as there is no larger unit to show.
- Fix
subSecondsAsDecimalsshowing0mswhen the seconds cannot show the value b88433650was0ms. It is now50ms.
- Fix
secondsDecimalDigitsandmillisecondsDecimalDigitsthrowing aRangeErrorfor values outside 0-100, and showingNaNsforNaNb9c75fc - Fix
unitCount: NaNreturning an empty string c00947e