dayjs icon indicating copy to clipboard operation
dayjs copied to clipboard

Formatting duration object with decimal value

Open Angusross111 opened this issue 3 years ago • 1 comments

Describe the bug Formatting a decimal value doesnt seperate out the hours and minutes

myDuration = dayjs.duration({ hours: 4.8 })
myDuration.format("HH:mm") => 4.8:undefined

Expected behavior

myDuration.format("HH:mm") => 04:48

The $ms is recorded correctly as $ms: 17280000 and the following outputs correctly:

dayjs.duration(17280000).format("HH:mm") => 04:48

Am I expected to break up the duration into respected hours and minutes before passing it to dayjs duration?

Information

  • Day.js Version [1.10.7]
  • OS: [Ubuntu 20.04]
  • Browser [chrome 94.]

Angusross111 avatar Oct 19 '21 21:10 Angusross111

Solution here : https://github.com/iamkun/dayjs/issues/965#issuecomment-975474746

innovaweb-dev avatar Aug 17 '22 08:08 innovaweb-dev