Disable drop on past dates in FullCalendar

我是研究僧i 提交于 2019-11-29 06:59:14

eventConstraint can disable dragging and dropping outside of established boundaries

To gray out past days

/* SHADE DAYS IN THE PAST */
td.fc-day.fc-past {
    background-color: #EEEEEE;
}

And for eventConstraint

        /* This constrains it to today or later */
        eventConstraint: {
            start: moment().format('YYYY-MM-DD'),
            end: '2100-01-01' // hard coded goodness unfortunately
        }

http://jsfiddle.net/1qsrjffL/

For the 'end' of eventConstraint, you could add days to the current date if you like vs hard coded

EDIT:

To gray out time in the day view you can use businessHours

businessHours: {
    start: moment().format('HH:mm'), /* Current Hour/Minute 24H format */
    end: '17:00', // 5pm? set to whatever
    dow: [0,1,2,3,4,5,6] // Day of week. If you don't set it, Sat/Sun are gray too
}

Dropping of external events onto the agendaDay in the past is allowed to occur. Editing the eventConstraint to include time will work 'YYYY-MM-DD HH:mm' but it prevents dropping on today in Month view...

http://jsfiddle.net/1qsrjffL/1/

eventDrop should get you there:

eventDrop: function(event, delta, revertFunc) {
        if(event.start < currentDate) {
            revertFunc();
        }
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!