Closed sandhuharjodh closed 5 months ago
For me events are showing in the next month.
Following is the code that i am using. const myEventsList = [ { id: 1, title: 'Test on Prod', start: new Date(2024, 1, 7), end: new Date(2024, 1, 7), }, { id: 92, title: 'Some Other Event', start: new Date(2024, 2, 9, 8, 0, 0), end: new Date(2024, 2, 9, 11, 30, 0), }, { id: 5, title: 'Conference', start: new Date(2015, 3, 11), end: new Date(2015, 3, 13), desc: 'Big conference for important people', }, { id: 8, title: 'Meeting', start: new Date(2024, 2, 12, 14, 0, 0, 0), end: new Date(2024, 2, 12, 15, 0, 0, 0), }, { id: 9, title: 'Happy Hour', start: new Date(2024, 3, 23, 22, 0, 0, 0), end: new Date(2024, 3, 23, 22, 30, 0, 0), desc: 'Most important meal of the day', },]
const myEventsList = [ { id: 1, title: 'Test on Prod', start: new Date(2024, 1, 7), end: new Date(2024, 1, 7), }, { id: 92, title: 'Some Other Event', start: new Date(2024, 2, 9, 8, 0, 0), end: new Date(2024, 2, 9, 11, 30, 0), }, { id: 5, title: 'Conference', start: new Date(2015, 3, 11), end: new Date(2015, 3, 13), desc: 'Big conference for important people', }, { id: 8, title: 'Meeting', start: new Date(2024, 2, 12, 14, 0, 0, 0), end: new Date(2024, 2, 12, 15, 0, 0, 0), }, { id: 9, title: 'Happy Hour', start: new Date(2024, 3, 23, 22, 0, 0, 0), end: new Date(2024, 3, 23, 22, 30, 0, 0), desc: 'Most important meal of the day', },]
<Calendar localizer={localizer} events={myEventsList} startAccessor="start" endAccessor="end" style={{ height: 800 }} />
Happy Hour is on March 23, but it showing on April 23 on my calendar
Even should show up in the mentioned month
It is coming in the next month
No response
It's not a bug and it's certainly not one in React-Calendar. In JavaScript, second argument in Date constructor is an integer representing the month: 0 for January, 1 for February, and so on.
Before you start - checklist
Description
For me events are showing in the next month.
Steps to reproduce
Following is the code that i am using.
const myEventsList = [ { id: 1, title: 'Test on Prod', start: new Date(2024, 1, 7), end: new Date(2024, 1, 7), }, { id: 92, title: 'Some Other Event', start: new Date(2024, 2, 9, 8, 0, 0), end: new Date(2024, 2, 9, 11, 30, 0), }, { id: 5, title: 'Conference', start: new Date(2015, 3, 11), end: new Date(2015, 3, 13), desc: 'Big conference for important people', }, { id: 8, title: 'Meeting', start: new Date(2024, 2, 12, 14, 0, 0, 0), end: new Date(2024, 2, 12, 15, 0, 0, 0), }, { id: 9, title: 'Happy Hour', start: new Date(2024, 3, 23, 22, 0, 0, 0), end: new Date(2024, 3, 23, 22, 30, 0, 0), desc: 'Most important meal of the day', },]
<Calendar localizer={localizer} events={myEventsList} startAccessor="start" endAccessor="end" style={{ height: 800 }} />
Happy Hour is on March 23, but it showing on April 23 on my calendar
Expected behavior
Even should show up in the mentioned month
Actual behavior
It is coming in the next month
Additional information
No response
Environment