jquense / react-big-calendar

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

event doesn't cover all days in month view when work with momentLocalizer in some time zone #2425

Open yungfu opened 1 year ago

yungfu commented 1 year ago

Check that this is really a bug

Reproduction link

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

Bug description

Init Calendar localizer by momentLocalizer by default time zone specified as following:

moment.tz.setDefault('pacific/Fiji'); //UTC+12
var localizer = momentLocalizer(moment);

Prepare a event:

  {
    id: 1, 
    title: 'Long Event',
    start: new Date("2015-04-12T08:10:00Z"),
    end: new Date("2015-04-14T08:40:00Z"),
  }

When your client is in a time zone which utc-offset is less than pacific/Fiji utc-offset, I am working on UTC+8 , this event will only display on 4/12, 4/13, not cover 4/14, the event on pacific/Fiji local time should be 4/12/2015 20:10 - 4/14/2015 20:40. Seems momentLoalizer/browserTZOffset make an incorrect compensation.

Expected Behavior

No response

Actual Behavior

No response

react-big-calendar version

1.8.1

React version

17.0.2

Platform/Target and Browser Versions

windows 11 edge

Validations

Would you like to open a PR for this bug?

Pyakz commented 3 months ago

still no answer?