Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff in days ignores Oct 31 2022 in European time zones #2109

Open
henrywoody opened this issue Nov 2, 2022 · 2 comments
Open

Diff in days ignores Oct 31 2022 in European time zones #2109

henrywoody opened this issue Nov 2, 2022 · 2 comments

Comments

@henrywoody
Copy link

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)]
@spormeon
Copy link

spormeon commented Nov 3, 2022

I think we have seen this as well yesterday, we have a system that shows when stats arrive with us and its missed the 31 oct/ 1st nov in effect, its shows the last date stats arrived but did "nothing" in effect for if the stats arrived last on 1st nov:
FrontendDev1994-_Discord
where as its back to working today, as the last stats in date is the 2nd november now:
Adysis_-Media_Online-_Stats_Management

our developer in India also saw it , as in no date showing and I'm in the UK

@felix0220170
Copy link

Oct 29, 2022 will be UTC+2. And Nov 1, 2022 will be UTC+1. so the result of diff will be about 71/24 ≈ 2.958333.
dayjs('2022-11-01T00:00:00Z').diff('2022-10-29T00:00:00Z', 'day', true) = 2.958333.

Similar issue: #2068

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants