Closed salmancrc closed 1 year ago
This is not a bug in react-big-calendar
.
new Date(2022, 12, 27)
returns the 27th of January 2023!
If you are already importing moment
, you will probably want to also use it to manipulate dates.
You don't have to pass defaultDate={new Date()}
, because by default the calendar opens up at the current day.
See also understanding dates for how to use the defaultDate
prop properly.
Check that this is really a bug
Reproduction link
https://codesandbox.io/s/funny-booth-hsub7o?file=/src/App.js
Bug description
The event is not showing on the calender when I pass the
defaultDate={new Date()}
. But when I pass the date with this formatdefaultDate={new Date(2022, 12, 27)}
It shows up. Can you help me out with this issue @jquense . ThanksExpected Behavior
<Calendar onNavigate={onNavigate} events={myEventsList} defaultDate={new Date()} localizer={localizer} step={15} // timeslots={8} defaultView='day' views={views} style={{height: 600}} />
Actual Behavior
<Calendar onNavigate={onNavigate} events={myEventsList} defaultDate={new Date(2022, 12, 27)} localizer={localizer} step={15} // timeslots={8} defaultView='day' views={views} style={{height: 600}} />
react-big-calendar version
1.5.2
React version
18.2.0
Platform/Target and Browser Versions
Chrome
Validations
Would you like to open a PR for this bug?