unable to pass variable into events section of calendar

Viewed 19

I'm trying to get events from database and display them onto a calendar. I'm using fullcalendar and I am able to see events that are set before hand.

            calendarOptions: {
                plugins: [ dayGridPlugin ],
                initialView: 'dayGridMonth',
                dateClick: this.handleDateClick,
                events: [
                    {
                    title  : 'event1',
                    start  : '2022-09-09'
                    },
                    {
                    title  : 'event2',
                    start  : '2022-09-05',
                    end    : '2022-09-07'
                    },
                    {
                    title  : 'event3',
                    start  : '2022-09-09 12:30:00',
                    allDay : false // will make the time show
                    },
                ]
            },

however if I wish to pass an object it becomes undefined.

                const events = [{title: 'test', start: response.booked[0].booking_date}]
                console.log(this.calendarOptions)

Not sure where I am going wrong..

0 Answers
Related