Disable event dates (fullcalendar)

0

I have the following code using the plugin "fullcalendar" and I would need to disable the dates that have registered event. I made a registration with the plugin's dayClick and then listed the entries with ajax.

var calendar = $("#calendar").fullCalendar({
            header: {
              left : "prev,next,today",
              center: "title",
              right: "month,listMonth"
            },
            buttonText: {
              listMonth: "Reservas"
            },
            height: 500,
                  navLinks: false, // can click day/week names to navigate views
                  editable: false,
                  eventLimit: true, // allow "more" link when too many events
            showNonCurrentDates: false,
            slotEventOverlap: false,
            // validRange,
            // dateIncrement,
            dayClick: function(date , view){
              $("#diaReserva").html(date.format('DD/MM/YYYY')+"?");
              $("#cadastroDataReserva").val(date.format());
              $('#confirmacaoReserva').modal();
            },
            defaultDate: new Date(),
            validRange: {
              start: moment().add('days',-1),
            },
            viewRender: function(view, element) {
              curdate = new Date();
              viewdate = new Date(view.start);
              // PREV - force minimum display month to current month
              if (new Date(viewdate.getFullYear(), viewdate.getMonth() + 1, 1).getTime() <= new Date(curdate.getFullYear(), curdate.getMonth(), 1).getTime()){
                $('.fc-prev-button').prop('disabled', true);
                $('.fc-prev-button').css('opacity', 0.5);
              }else {
                $('.fc-prev-button').prop('disabled', false);
                $('.fc-prev-button').css('opacity', 1);
              }
              // NEXT - force max display month to a year from current month
              if (new Date(viewdate.getFullYear(), viewdate.getMonth() + 1).getTime() >= new Date(curdate.getFullYear() + 1, curdate.getMonth() + 1).getTime()){
                $('.fc-next-button').prop('disabled', true);
                $('.fc-next-button').css('opacity', 0.5);
              }else {
                $('.fc-next-button').prop('disabled', false);
                $('.fc-next-button').css('opacity', 1);
              }
            },
            selectable: false,
            selectOverlap: false,
            events: "buscarReservas.php?idCondominio="+idCondominio,
          });

So when I register an event he can not let me register another one on the same day because he is disabled

    
asked by anonymous 21.08.2017 / 16:06

1 answer

0

use validRange:{start: new Date().toISOString().substring(0,10)} , this option will show days from the current date. I hope I have helped;

    
11.10.2017 / 23:48