jsmreese / moment-duration-format

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

format negative duration without trim #104

Closed firsttris closed 6 years ago

firsttris commented 6 years ago

holla,

nice plugin! here is my issue / question:

How to format negative duration without trim? i want to get -00:06 instead i get 00:-06

const test = moment.duration(-60*60*100).format('hh:mm', {
    trim: false
});
console.log(test);
>>> 00:-06

kind regards Tristan

jsmreese commented 6 years ago

Hmmm. I'd have sworn I was testing cases like that, but apparently not. I'm not sure what's going on, but hopefully I can take a look at it and publish an updated version this evening.

jsmreese commented 6 years ago

@firsttris I've published version 2.2.2 with this fix. Please let me know if you see any other issues around negative durations.

firsttris commented 6 years ago

thx @jsmreese

v 2.2.2 resolved the issue for me.