diff bug
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
```
const dayjs = require('dayjs')
let diff = dayjs().diff(dayjs('2023-09'), 'month')
let diff2 = dayjs().diff(dayjs('2023-08'), 'month')
let diff3 = dayjs().diff(dayjs('2023-07'), 'month')
console.log(dayjs().format('YYYY-MM-DD HH:mm:ss')) // 2023-08-04 16:06:48
console.log(dayjs('2023-09').format('YYYY-MM-DD HH:mm:ss')) // 2023-09-01 00:00:00
console.log("diff",diff) // 0 ???
console.log("diff2",diff2) // 0 ???
console.log("diff3",diff3) // 1
```
为什么9月和8月都是0?
Contributor guide
Research direction
Begin by running the inline JavaScript reproduction from the issue with the three input dates and the shown current date. Determine the intended month-difference behavior for the September and August cases, then trace the relevant diff behavior. Done means the discrepancy is explained or corrected and the reproduction has regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100