Reputation: 1195
I wrote a component with a timer. Two values are transferred to it - the start and end times, from which I get the difference:
const differenceTime = this.endTime - this.startTime
Values are passed in correctly, because:
console.log(
duration,
duration.minutes(),
duration.asMinutes()
)
It shows:
Duration {_isValid: true, _milliseconds: 3931000, _days: 0, _months: 0, _data: {…}, …}
5
65.51666666666667
That is, it proves that my code and values are generally correct. Then why does the minutes()
method pass some kind of trimmed number? When it was 69 minutes, this method showed 9. When it was 68 minutes, this method showed 8.
Upvotes: 0
Views: 214
Reputation: 414
When you are using minutes()
, it will literally return your minutes value. That means, if you have time of 1 hour and 5 minutes (65 minutes in total), it will just return 5.
Upvotes: 1