vue-moment icon indicating copy to clipboard operation
vue-moment copied to clipboard

Unable to custom format duration('mm:ss')

Open wwwizzarrdry opened this issue 6 years ago • 1 comments

Nice port, but the duration method needs to accept a custom format string.

I.E. {{ 3600000 | duration('hh:mm:ss') }}

Or allow chaining duration back into moment, {{ 3600000 | duration() | moment('hh:mm:ss') }}

wwwizzarrdry avatar Nov 30 '18 07:11 wwwizzarrdry

Agree! A workaround to go from milliseconds or seconds to a formatted string is to use a method as follows:

methods: {
      durationDisplay: function(sec) {
        return this.$moment.utc(sec * 1000).format('h[h] m[m] s[s]')
      }
    }

wsitch avatar Feb 14 '20 21:02 wsitch