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

Daylight saving time issue #4249

Closed
darakeon opened this issue Oct 17, 2017 · 3 comments
Closed

Daylight saving time issue #4249

darakeon opened this issue Oct 17, 2017 · 3 comments

Comments

@darakeon
Copy link

darakeon commented Oct 17, 2017

The function endOf of 2017-10-15 returns a value greater than startOf of 2017-10-16

  • GMT-3h, Brazil
  • Chrome, Firefox and Edge - Windows 10
  • Chrome - Arch Linux
  • version 2.18.1

The code we've done as fix:

    let endOf = dates.clone().endOf('day')

    const startOfDayAfter =
      dates.clone().add(1, 'days').startOf('day')

    if (startOfDayAfter.isBefore(endOf)) {
      endOf = startOfDayAfter.add(-1, 'milliseconds')
    }
@derekstavis
Copy link

This issue was originally found on react-dates/react-dates/issues/776

@darakeon darakeon changed the title Summer time issue Daylight saving issue Oct 18, 2017
@darakeon darakeon changed the title Daylight saving issue Daylight saving time issue Oct 18, 2017
@icambron
Copy link
Member

Yeah, this is an old bug and it's particularly acute in Brazil because of the midnight DST. See e.g. #1990, #4164, #2749, and most importantly #3132

@darakeon
Copy link
Author

@icambron, after opening the issue I looked into the code and fixed it: #4254

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

Successfully merging a pull request may close this issue.

3 participants