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();
});
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.
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.
var view = $('#calendar').fullCalendar('getView');
if (view.name == 'month') {
}
$('#calendar').fullCalendar({
viewDisplay: function(view) {
alert('The new title of the view is ' + view.title);
// view consist Available views
// month, basicWeek,basicDay,agendaWeek,agendaDay
}
});
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With