Open mg1075 opened 5 years ago
This is another floating point rounding issue and related to #121.
You'll want to use the precision
option in this case:
moment.duration(3.033333333, "minutes").format("H:mm:ss", 1);
"3:02.0"
moment.duration(3.033333333, "minutes").format("H:mm:ss", 2);
"3:02.00"
moment.duration(3.033333333, "minutes").format("H:mm:ss", 3);
"3:02.000"
What is going on here? Is there a fix or workaround?
moment.duration(3.033333333, "minutes").format("H:mm:ss.SSS");
ormoment.duration(3.033333333, "minutes").format("H:mm:ss.S");
...yield this result:
"3:01.1,000"
And then to confuse the situation further,
moment.duration(3.033333333, "minutes").format("H:mm:ss.SS");
...yields:"3:01.10"