iamkun / iamkun/dayjs

Bug diff() method

Open
#757 0 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

```
var now = dayjs(new Date('Sat Dec 21 2019 00:00:00 GMT+0100')).utc().utcOffset(240)
var birthday = dayjs('1999-12-21')
```

I have current UTC+1 in my node process.
So 2019-12-21 => in UTC : 2019-12-20 23:00:00 => offset +240 => 2019-12-21 3:00:00

1999-12-21 <=> 2019-12-21 3:00:00 => ouput 19.999663978494624 🤔 ????
(`now.diff(birthday, 'year', true)`)

Other test :
```
var now = dayjs('2019-12-21T00:00:00.000Z').utcOffset(5999000)
var birthday = dayjs('1999-12-21T00:00:00.000Z')

now.diff(birthday, 'year', true) => output: 8.97341696535245, so buggy
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.