jsmreese / moment-duration-format

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

Negative values are handled incorrectly when using `stopTrim` #86

Closed pediredla closed 6 years ago

pediredla commented 6 years ago

moment.duration(-600, 'seconds').format('hh:mm', {stopTrim: 'h m', forceLength: true})

outputs 00:10 and not -00:10.

is this an expected behaviour?

jsmreese commented 6 years ago

Yikes! Nope, certainly not expected. Not sure why the existing negative duration tests don't catch this one, but I'll take a look.