How to block out dates in the Fullcalendar beyond a certain date

后端 未结 7 1142
心在旅途
心在旅途 2020-12-08 16:51

I have a date in the future which is always 30 days ahead of the current date. It\'s stored in a Date object. I worked this out using:

var currentDate = new          


        
相关标签:
7条回答
  • 2020-12-08 17:48

    Simply add this code in Fullcalendar:

    select: function (start, end, jsEvent, view) {
                if (start.isBefore(moment())) {
                    $('#calendar').fullCalendar('unselect');
                    return false;
                }
                else {
    
                     var currentDate = moment(start).format('YYYY/MM/DD'));
                     alert(currentDate);
                } 
            }
    

    Simple and fast. Enjoy!

    0 讨论(0)
提交回复
热议问题