I'm trying to change the minTime in fullcalendar according to the database schedule through an ajax request on the viewRender, but it goes into a loop.
Part of my calendarOptions:
var calendarOptions = {
header: {
left: ' today',
center: 'prev,title,next',
right: 'agendaWeek,resourceDay'
},
defaultView: 'resourceDay',
The viewRender:
viewRender: function(view, element){
var curDate = ($('#calendar').fullCalendar('getDate')).format('d-DD-MM').split('-');
var curWeekDay = curDate[0];
var curMonthDay = curDate[1];
var curMonth = curDate[2];
$.ajax({
url: 'calendar/getBusinessHours',
type: 'GET',
data: {
'day': curWeekDay,
"_token": $('body').find( 'input[name=_token]' ).val()
},
success: function (response) {
$('#calendar').fullCalendar("destroy");
$("#calendar").fullCalendar(
$.extend(calendarOptions, {
defaultDate: currentDate,
minTime: response[0].open_time+':00',
maxTime: response[0].close_time+':00'
})
);
}
});
},
The ajax response is '08:00:00' so there is no problem there;