jsmreese / moment-duration-format

Format function plugin for the Moment Duration object.
MIT License
968 stars 120 forks source link

moment.duration.format error with zero-value tokens and significant digits on HTC mobile browser #96

Closed jsmreese closed 6 years ago

jsmreese commented 6 years ago

When using significant digits and moment.duration.format, tokens that have zero value are rendered as 0.0 instead of 0.

This occurs on the HTC One emulator on BrowserStack, Android 4.4. I've not yet tested on an actual HTC device.

jsmreese commented 6 years ago

Verified that issue is present on a physical HTC One device.

jsmreese commented 6 years ago
equal(moment.duration(10, "seconds").format("h[h] m[m] s[s]",
{
    useSignificantDigits: true,
    trim: false
}), "0h 0m 10s"); // Passes on HTC One
equal(moment.duration(10, "seconds").format("h[h] m[m] s[s]",
{
    useSignificantDigits: true,
    precision: 4,
    trim: false
}), "0h 0m 10s"); // Fails on HTC One