jsmreese / moment-duration-format

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

Parsing seems broken #77

Closed bendavis78 closed 6 years ago

bendavis78 commented 6 years ago

Not sure whether or not this is an issue with moment core, but the following use case is broken:

moment.duration('5:30', 'm:ss', true);

should result in 5 minutes 30 seconds, but instead it results in 5 hours 30 minutes.

jsmreese commented 6 years ago

Not sure if that ever worked, but it certainly doesn't now... From moment itself, the duration constructor only takes two arguments:

function createDuration (input, key)

https://momentjs.com/docs/#/durations/

And from what I can tell the second argument is a unit of measurement as defined in moment, e.g. minutes or seconds or a shorthand unit, e.g. m or s. It doesn't look like a format string is supported there.

My plugin doesn't affect parsing of duration strings in moment.duration!

bendavis78 commented 6 years ago

Makes sense. Thanks!