jquense / react-big-calendar

gcal/outlook like calendar component
http://jquense.github.io/react-big-calendar/examples/index.html
MIT License
7.81k stars 2.23k forks source link

DayjsLocalizer slows calendar when set default timezone #2448

Open sinedie opened 1 year ago

sinedie commented 1 year ago

Check that this is really a bug

Reproduction link

https://codesandbox.io/s/react-big-calendar-example-forked-gyv3sn?file=/src/App.js

Bug description

When using DayjsLocalizer with a default timezone the calendar gets really laggy. Seems like it re-renders or render too slow.

Expected Behavior

No response

Actual Behavior

No response

react-big-calendar version

^1.8.4

React version

18.2.0

Platform/Target and Browser Versions

NodeJs v18.14.2, Firefox 117.0.1

Validations

Would you like to open a PR for this bug?

georgichichev commented 10 months ago

@sinedie Have you found some kind of a fix for this? I am experiencing the same issue.

sinedie commented 10 months ago

@georgichichev I just don't configure any timezone at the moment. It is not ideal -but in my use case my users are in the same country-.

But still, you could use momentjs or date-fns as DateLocalizer. The downside is if you still wanna use Dayjs in your dates -outside the calendar- then you have two packages for the same thing.

georgichichev commented 10 months ago

@sinedie I strictly have to configure a timezone because some events are then displayed with 1 extra day if I do not configure a timezone. The events that are displayed on the calendar are created by the users. For example, an event that has this end date "2023-11-08T23:59:59.000Z" will end on 2023-11-09 on the calendar. Have not found any other way to fix this.

I don't know if it is a good idea to use momentjs for the localizer since all the rest of the application - forms, datepickers etc. are using dayjs.