jsmreese / moment-duration-format

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

Allow `useSignificantDigits` to function with `trim` #88

Closed jsmreese closed 6 years ago

jsmreese commented 6 years ago
equal(moment.duration({ hours: 2, seconds: -60 }).format("h:mm", { precision: 2, useSignificantDigits: true }), "2"); // 1:60
equal(moment.duration({ hours: 2, seconds: -60 }).format("h:mm", { precision: 2, useSignificantDigits: true, trim: false }), "2:00"); // 1:60

Setting useSignificantDigits should default trim to "all".