Fullcalendar - limit selectable to a single day

前端 未结 6 702
慢半拍i
慢半拍i 2020-12-10 04:31

By default if you enable the \'selectable\' attribute it will allow you to click and drag and select several days. I would like to only allow the user to select a single day

6条回答
  •  不思量自难忘°
    2020-12-10 05:32

    Why not use selectAllow?

    Start by converting the start and end times to seconds. Compare that to the number of seconds in a day.

    Working Solution Without Using Moment.js:

    selectAllow: function (e) {
       if (e.end.getTime() / 1000 - e.start.getTime() / 1000 <= 86400) {
           return true;
       }
    }
    

提交回复
热议问题