How to make past date unselectable in fullcalendar?

前端 未结 15 1269
暗喜
暗喜 2020-12-08 07:46

Problem is, how to disable selectable on PAST DATES in fullcalendar\'s month/week view.

I want to user not allowed to click/select the on past dates.

15条回答
  •  無奈伤痛
    2020-12-08 08:27

    In Fullcalendar i achieved it by dayClick event. I thought it is the simple way to do it.

    Here is my code..

     dayClick: function (date, cell) {
                  var current_date = moment().format('YYYY-MM-DD')
                  // date.format() returns selected date from fullcalendar
                  if(current_date <= date.format()) {
                    //your code
                  }
                }
    

    Hope it helps past and future dates will be unselectable..

提交回复
热议问题