iamkun / iamkun/dayjs

dayjs.duration(y.diff(x)) The year, month and day in the object are not accurate

Open
#1,063 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
JAVA:
![20200921173246](https://user-images.githubusercontent.com/21234925/93752069-b3990080-fc30-11ea-9e23-ce355376c863.png)

Javascript-dayjs:
![20200921173615](https://user-images.githubusercontent.com/21234925/93752321-14283d80-fc31-11ea-89d8-104f0dff22be.png)
![20200921173639](https://user-images.githubusercontent.com/21234925/93752335-1b4f4b80-fc31-11ea-9f52-a121cbe04eb4.png)

Why is the calculation of months and days like this?

**Expected behavior**
Hope to get the right result

**Information**
- Day.js Version [v1.8.36]
- OS: [window]
- Browser [chrome 85]
- Time zone: [Mon Sep 21 2020 17:47:43 GMT+0800 (中国标准时间)]

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. First reproduce dayjs.duration(y.diff(x)) with Day.js v1.8.36 and compare its year, month, and day values with the Java result shown in the issue; clarify the intended calendar semantics before locating the duration and diff tests. Done means the expected component values are defined and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.