Large diffs display wrong hours
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Due to this PR [https://github.com/iamkun/dayjs/pull/2362](https://github.com/iamkun/dayjs/pull/2362), when we perform large diffs and construct a duration from it, the wrong number of hours is computed in the resulting duration. Example:
```js
dayjs.duration(dayjs('2020-04-01 08:00:00').diff('2020-01-27 10:00:00')).format('HH:mm:ss') // displays '01:00:00'
```
**Expected behavior**
```js
dayjs.duration(dayjs('2020-04-01 08:00:00').diff('2020-01-27 10:00:00')).format('HH:mm:ss') // should display '21:00:00'
```
**Information**
- Day.js Version: [v1.11.10]
- OS: [iOS]
- Browser: [chrome 120.0.6099.234]
- Time zone: [e.g. GMT+01:00 (Central European Standard Time)]
Contributor guide
Research direction
Start by reproducing the issue with the dayjs.duration(dayjs(...).diff(...)).format('HH:mm:ss') example and inspect the duration and diff entry points, including the behavior introduced by PR 2362. Done means the supplied large-date example displays 21:00:00 instead of 01:00:00, with regression coverage for the case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100