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

1.9.7 Timezone StartOf Possible Regression #1275

Open
ChildishDanbino opened this issue Dec 15, 2020 · 2 comments
Open

1.9.7 Timezone StartOf Possible Regression #1275

ChildishDanbino opened this issue Dec 15, 2020 · 2 comments

Comments

@ChildishDanbino
Copy link

Describe the bug
With the release of dayJS 1.9.7 we noticed our charts were rendering incorrect data or no data at all. I was able to trace the issue down to dayJS.tz startOf function returning new data between 1.9.6 and 1.9.7 which is a possible side-effect of #1229.

Note: We are attempting to do a conversion from MomentJS -> DayJS so I have included the momentJS result for the same logic.

1.9.7:
  const start = dayjs.tz('2020-12-15T14:54:51.227', 'Europe/London ').startOf('second').format();
  Returns: 2020-12-15T19:54:51+00:00

1.9.6:
 const start =  dayjs.tz('2020-12-15T14:54:51.227', 'Europe/London').startOf('second').format()
 Returns:  2020-12-15T14:54:51+00:00

momentJs
 const start = moment.tz('2020-12-15T14:54:51.227', 'Europe/London ').startOf('second').format()
 Returns: 2020-12-15T14:54:51Z

Upon further inspection of the dayJS object the $h variable seems to have changed between the releases which is causing the issue. I'm not 100% sure if this is intended behavior or not and if there is a correct way to achieve the same result as 1.9.6 in 1.9.7 but I figured I would bring attention to the side-effect in case others had a similar result.

One thing to note is that momentJS for the same logic returns the same result as 1.9.6

Expected behavior
DayJS startOf would output the same result for startOf across minor releases and / or mimic the result of momentJS.

Information

  • Day.js Version: 1.9.7 vs 1.9.6
  • OS: Mac OS Mojave
  • Browser :Google Chrome: Version 87.0.4280.88 (Official Build) (x86_64)
  • Time zone: US Eastern Standard Time (EST -5:00)
@reh2ur
Copy link

reh2ur commented Dec 16, 2020

This issue also leads to a bug with isSame, where date.isSame(date) is false while date.isAfter(date) is true for me.

@kacper-kruczek
Copy link

This issue is still present, did anybody found fix for this yet?

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