diff malfunctions when dates go across the ST/DST change date
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
example of issue: https://replit.com/@AndreLowy/dayjs-diff-DST-issue?v=1
When using the `diff` method, if the first date is in Standard Time (ST) and the second date is in Daylight Savings Time (DST) or vice versa, the diff result will be incorrect. In the above repl, we have Nov 5 and Nov 11 at the same time of day. I run the diff method against those dates in UTC (doesn't use DST) and in America/Toronto zones (uses ST and DST). In UTC, the diff in days is 6, and in America/Toronto, it's only 5, but they should both be 6.
It seems like diff should take the ST/DST switch into consideration.
**Expected behavior**
I expect the `diff` method to be aware of the ST/DST change between two dates and take that into consideration when making the comparison. In my repl example, both scenarios should return 6 days.
**Information**
- Day.js Version ^1.10.7 => 1.11.5 at the time of writing this ticket
- OS: iOS
- Browser chrom Version 106.0.5249.91 arm64
- Time zone: America/Toronto GMT-05:00 ST (Eastern Standard Time)
Contributor guide
Assessment
This issue has not been assessed yet.