I want to call an API which accepts from_date and to_date. So every time I changed the view of the calendar I would like to call an API and update the data event accordingly. If I move forward or back how do I get the initial date and final date of the month?

Link to full calendar

I have the API docs from fullcalendar.io but not sure why it is not working.

https://fullcalendar.io/docs/v3/getView

It clearly mentioned that this way you can get the view and DateTime.

var view = $('#calendar').fullCalendar('getView');
alert("The view's title is " + view.title);

But when I run the above code it says

VM39:1 Uncaught TypeError: $(...).fullCalendar is not a function

I even tried this function at the fullcalendar.io website. It says the same. Not sure what is the issue.

I am using below code to initialize my calendar.

var calendarEl = document.getElementById('calendar');

var calendar = new FullCalendar.Calendar(calendarEl, {
  plugins: [ 'dayGrid', 'timeGrid', 'list', 'interaction' , 'momentTimezone' ],
  header: {
    left: 'prev,next today',
    center: 'title',
    right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
  },
  defaultDate: '2019-04-12',
  navLinks: true, // can click day/week names to navigate views
  editable: false,
  eventLimit: true, // allow "more" link when too many events
  events: sessionCalendar,
});
calendar.render();

https://fullcalendar.io/

0 Answers