Formatting duration object with decimal value
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**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.]
Contributor guide
Research direction
Start by reproducing the dayjs.duration({ hours: 4.8 }).format("HH:mm") example and compare it with formatting dayjs.duration(17280000). The issue is done when the decimal-hour input produces 04:48, matching the expected output without manually splitting the duration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100