Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide cells of previous and next month from current month view in fullcalendar?

I want to hide cells of previous and next month dates, which are coming in current month view. I tried adding css but not working for me:

<style>
    .hiddenEvent{display: none;}
    .fc-other-month .fc-day-number { display:none;}

    td.fc-other-month .fc-day-number {
        visibility: hidden;
    }
</style>

I want to hide cells, so that user cannot create events by clicking on next month's days. Here user is able to create events on blank cells also i.e next month dates Thank you.

like image 501
nirux Avatar asked Apr 05 '15 04:04

nirux


1 Answers

From version 3.3.0 you can now use showNonCurrentDates: false .

        $('#calendar_1').fullCalendar({
        header: {
            left: '',
            center: 'title',
            right: ''
        },
        defaultView: 'month',
        editable: true,
        allDaySlot: true,
        selectable: true,
        selectHelper: true,
        selectOverlap: false,
        fixedWeekCount: false,
        showNonCurrentDates: false,
        select: function (start, end) {
            var title = "Available";
            var evid = SaveEvent(start, end, '1');
            $('#calendar_1').fullCalendar('unselect');
        },
        eventClick: function (calEvent, jsEvent, view) {
            var ev_id = calEvent.ID;
            var st_dt = calEvent.start;
            var ed_dt = calEvent.end;
            infoEventShow('1', ev_id, st_dt, ed_dt);
        },
        slotMinutes: 15,
        events: '/Aircrew/GetEvents/',
        eventColor: '#339900'
    });

Reference https://fullcalendar.io/docs/display/showNonCurrentDates/

like image 50
SteveP Avatar answered Oct 11 '22 13:10

SteveP