Diff in days ignores Oct 31 2022 in European time zones
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
The result of the `diff` method for the `"day"` unit is wrong around Oct 31, 2022 in European time zones. The result seems to ignore the existence of the 31st of Oct.
For example the diff in days between Nov 1 and Oct 30 is 1 (when it should be 2) and the problem occurs for dates further apart than that (one day less than expected). The problem does not occur in the year 2020 (only other year I tested).
Here is a fiddle link: https://jsfiddle.net/henrywoody/9gsdpyb8/5/
I tested in the following time zones:
- GMT-07:00 PDT (Pacific Daylight Time): no issue
- GMT-04:00 EDT (Eastern Daylight Time): no issue
- GMT+00:00 GMT (Greenwich Mean Time): **issue present**
- GMT+02:00 CAT (Central African Time): no issue
- GMT+02:00 EET (Eastern European Time): **issue present**
- GMT+08:00 CST (China Standard Time): no issue
- GMT+11:00 AEDT (Australia Eastern Daylight Time): no issue
Pretty stumped by this one.
**Expected behavior**
Expected day diff between Nov 1 and Oct 30 to be 2.
**Information**
- Day.js Version: v1.11.6 (also v1.10.7)
- OS: MacOS 12.4 (on Apple M1)
- Browser: Safari 15.5
- Time zone: GMT+02:00 EET (Eastern European Time)]
Contributor guide
Assessment
This issue has not been assessed yet.