How can I disable some dates range in a fullcalendar?

旧街凉风 提交于 2019-12-06 22:48:32

问题


I want to disable days before and after dates range, anybody know how can I do that? (sorry for my english).

Hernan


回答1:


so you mean on the ACTUAL calendar you don't want people to book certain dates?

Look at this link

http://jsfiddle.net/ppumkin/7MTdn/

Click on a day 15 days later and the alert changes.. something like this? Yea

If that is what you mean i can try and change it for your needs..

$('#mycalendar').fullCalendar(
            {
             header: {
                    left: 'prev,next today',
                    center: 'title',
                    right: 'month,agendaWeek,agendaDay'
                    },


                dayClick: function( date, allDay, jsEvent, view ) { 
                    var myDate = new Date();

                    //How many days to add from today?
                    var daysToAdd = 15;

                    myDate.setDate(myDate.getDate() + daysToAdd);

                    if (date < myDate) {
                        //TRUE Clicked date smaller than today + daysToadd
                    alert("You cannot book on this day!");    
                    }
                    else
                    {
                        //FLASE Clicked date larger than today + daysToadd
                        alert("Excellent choice! We can book today..");    
                     }   


            },      

             events: [

                        {
                            title  : 'event2',
                            start  : '2011-03-10',
                            end    : '2011-05-5'
                        }
                    ]
           }); 

Please note this was written compatible for 1.6.4 and that from version 2+ most of the API has changed and things should be different but the general events and logic should be the same.



来源:https://stackoverflow.com/questions/5991941/how-can-i-disable-some-dates-range-in-a-fullcalendar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!