dayjs.duration() incorrect result
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Currently for dayjs.duration() in the ``` src/plugin/duration/index.js ``` the amount of days in a month is calculated as 365 / 12. This produces wrong results. Average value for a year is 365.2422 days.
```
dayjs.duration(dayjs('2020-04-01 08:00:00').diff('2020-01-27 10:00:00'))
```
returns:
```
{ years: 0, months: 2, days: 4, hours: 1, minutes: 0, seconds: 0, milliseconds: 0 }
```
**Expected behavior**
Year duration equal to 365.2422 days.
Month duration equal to (365.2422 / 12) days.
```
dayjs.duration(dayjs('2020-04-01 08:00:00').diff('2020-01-27 10:00:00'))
```
should return:
```
{ years: 0, months: 2, days: 4, hours: 0, minutes: 1, seconds: 52, milliseconds: 319.9999990463257 }
```
**Information**
Day.js Version: [v1.11.10]
Contributor guide
Assessment
This issue has not been assessed yet.