jsmreese / moment-duration-format

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

Allow `maxValue` and `minValue` to function with `trim` #83

Closed jsmreese closed 6 years ago

jsmreese commented 6 years ago

Failing test:

equal(moment.duration(10.01, "minutes").format("m:ss", { maxValue: 10, trim: false }), "> 10:00");
equal(moment.duration(10.01, "minutes").format("m:ss", { maxValue: 10 }), "> 10:00");
equal(moment.duration(10.01, "minutes").format("m:ss", { maxValue: 10, trim:  }), "> 10:00");

If maxValue is surpassed, trim should do something useful based on context. Likewise with minValue.