E
E
Eugene2018-10-11 13:18:19
Vue.js
Eugene, 2018-10-11 13:18:19

How to properly format time in vue-moment?

I understand vue and vue-moment.
Installed moment-duration-format
I'm trying to convert seconds to hours: minutes: seconds. The number of seconds is converted to this format if the number of seconds is greater than 3599, otherwise it is formatted as minutes:seconds.
How to format correctly?

<tr>
  <td>{{item.date}}</td>
  <td>{{item.id}}</td>
  <td>{{item.name}}</td>
  <td>{{item.phone}}</td>
  <td>{{item.address}}</td>
  <td>{{item.status}}</td>
  <td>{{[-item.last_edited, "seconds"] | duration("humanize", true)}}</td>
  <td>{{ [item.open, "seconds"] | duration(item.open, "hh:mm:ss").format() }}</td>
</tr>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-10-11
@Eugeny1987

<td>{{ item.open | moment('utc', 'HH:mm:ss') }}</td>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question