Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find monthview or week view or day view in full calendar

I am using full calendar. here my question is how to find the fullcalendar is in month view, week view or day view in format when clicking prev button or next button clicking function. here am calling custom code for next and prev buttons. because using this I want to fire some custom data. based on fullcalendar view.

 $(document).on('click', '.fc-button-next a span', function () {

here I want to find the view of full calendar which is in month or week or day

       var abc = $("#calendar").fullCalendar('getView').start.toString();
       var MonthVal = getMonthValue(abc);
       var YearVal = getYearValue(abc);

       $('#calendar').fullCalendar('destroy');

       dataString = "{ID:" + MonthVal + "," + "year:" + YearVal + "}";

       DisplayCalendarForMonth(dataString, MonthVal, YearVal);
   });
   $(document).on('click', '.fc-button-today a span', function () {

here I want to find the view of full calendar which is in month or week or day

       $('#calendar').fullCalendar('destroy');
       DisplayCalendar();
   });
like image 460
sandeep Avatar asked Jun 24 '13 05:06

sandeep


People also ask

What is full calendar month?

Full calendar month means the period which begins at midnight on the last day of the previous month and ends at midnight on the last day of the month under consideration.

What is a month view?

Outlook Mobile now has a Month view in Calendar, in addition to the existing Agenda, Day, and 3-Day views. The Month view is optimized for viewing an entire month at a time, and quickly swiping between months when in the Calendar.


3 Answers

 var view = $('#calendar').fullCalendar('getView');
if (view.name == 'month') {
}
like image 59
sandeep Avatar answered Sep 29 '22 16:09

sandeep


$('#calendar').fullCalendar({
    viewDisplay: function(view) {
      alert('The new title of the view is ' + view.title);

      // view consist Available views
      // month, basicWeek,basicDay,agendaWeek,agendaDay
    }
});
like image 38
pixelbyaj Avatar answered Sep 29 '22 17:09

pixelbyaj


 var view = $('#calendar').fullCalendar('getView');

not working for me, instead I use:

var calendar = new FullCalendar.Calendar(document.getElementById('calendar'), {
  ...
}

console.log(
  calendar.view.type
);

Console prints: dayGridMonth

like image 42
Sinan Eldem Avatar answered Sep 29 '22 15:09

Sinan Eldem