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

Setting min and max displays calendar events a week earlier than they are scheduled the week of DST #2466

Open
4 of 5 tasks
prestontunnellwilson opened this issue Nov 13, 2023 · 5 comments
Labels

Comments

@prestontunnellwilson
Copy link

Check that this is really a bug

  • I confirm

Reproduction link

https://codesandbox.io/s/react-big-calendar-example-forked-w4u7s2?file=/index.js

Bug description

Viewing a week of events the week of the daylight savings time shift (in New York timezone) results in events being displayed on hour earlier. This happens when min and max are specified.

They show the correct time in the Day view, but when November 5th, 2023 (when DST occurred), the events display one hour earlier:

calendar-event-hour-early-in-week

You can see that the min and max are different in the day with DST compared to the days without. The code specifies

  const min = useMemo(() => new Date(2023, 10, 5, 8, 0, 0, 0), []);
  const max = useMemo(() => new Date(2023, 10, 5, 21, 0, 0, 0), []);

But when November 5th, 2023 shows up the min and max are instead 0700 and 2000.

Expected Behavior

The min's and max's are the same regardless of whether the week includes the Daylight Savings time transition or not, and the calendar events show up at the same time when they are scheduled for according to the Day view.

Actual Behavior

The min's and max's are shifted an hour earlier the week of DST when in week view and the day of DST when in day view and calendar events for that week in week view show up an hour earlier.

react-big-calendar version

1.8.5

React version

18.2.0

Platform/Target and Browser Versions

macOS Chrome

Validations

  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
  • Make sure this is a react-big-calendar issue and not an implementation issue

Would you like to open a PR for this bug?

  • I'm willing to open a PR
@bu6n
Copy link
Contributor

bu6n commented Nov 14, 2023

What localizer are you using? luxon? Are you sure this is related to min and max? If this is possible for you, you could test changing localizers. I fixed this bug for moment earlier this year (#2374), and it's not present in date-fns, but as far as I know it's still present in luxon.

@prestontunnellwilson
Copy link
Author

What localizer are you using

This is using moment, interestingly enough:

    "moment": "2.29.4",
    "moment-timezone": "0.5.38",

@bu6n
Copy link
Contributor

bu6n commented Nov 15, 2023

Could you try with date-fns just to see if the problem persists?

@prestontunnellwilson
Copy link
Author

@bu6n I am sorry for the delay in responding! Trying with date-fns, the problem does not persist. I verified this in https://codesandbox.io/s/react-big-calendar-example-forked-g8hk7z?file=/index.js.

That seems to me to point to an issue somewhere in moment or the moment localizer. Does that match what you're thinking?

@bu6n
Copy link
Contributor

bu6n commented Jan 17, 2024

Yes, I only use date-fns now because I had all sort of problems with moment...

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

No branches or pull requests

2 participants