Closed
Description
Describe the bug
Problem: The Duration.toISOString()
will format an ISO string with arbitrary precision floating point seconds. Although the specification doesn't define the precision the seconds field should have, it would likely be better to keep to some common format. The moment
library uses the millisecond precision, as does the Java Duration
.
I noticed this behavior when moving from moment
. We were sending ISO durations to our Java backend and it quickly started throwing exceptions trying to parse the durations.
Expected behavior
Example:
Input: duration(2/3)
Expected: PT0.001S
Actual: PT0.0006666666666666666S
Information
- Day.js Version [e.g. v1.11.8]
- OS: All
- Browser All
- Time zone: N/A