Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove allDay from view in fullcalender JS?

I am trying to build an application that creates events within fullcalendar. I don't allow user to create an "allDay" event at all at the client side but they still can see it within the view. Is there any method to remove allDays from views completely?

function initCalendar {
    if (!jQuery().fullCalendar) {
        return;
    }

    var date = new Date(),
        started,
        ended

    var header = {};

    var calendar = $('#calendar').fullCalendar({
        header: header,
        selectable: true,
        selectHelper: true,

        select: function (start, end, allDay) {
            $('#fc_create').click();
            var dateStart = start; 
            var dateEnd = end;

            $(".antosubmit").on("click", function() {
                var title = $("#reservation-title").val();

                if (title) {
                    var event = {
                        editable: true,
                        title: title,
                        start: dateStart,
                        end: dateEnd,
                        allDay: false
                    }

                    calendar.fullCalendar('renderEvent', event, true);
                    calendar.fullCalendar('unselect');
                    #('.antoclose').click();

                    return false;
                }
                else {
                    ////alert here
                }
            })
        }
    })
}
like image 243
KaraKaplanKhan Avatar asked Sep 12 '17 13:09

KaraKaplanKhan


1 Answers

From the docs:

allDaySlot: false

https://fullcalendar.io/docs/agenda/allDaySlot/

** Update for v5: https://fullcalendar.io/docs/allDaySlot

like image 76
jhen Avatar answered Nov 20 '22 01:11

jhen