Fullcalendar - limit selectable to a single day

前端 未结 6 713
慢半拍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:10

    in the select callback, adding the following does the trick: (fullcalendar 2 using moment.js)

    if (start.add('days', 1).date() != end.date() )
      $scope.eventCal.fullCalendar('unselect');
    

    resources:

    http://arshaw.com/fullcalendar/docs/selection/select_callback/ http://arshaw.com/fullcalendar/docs/selection/unselect_method/

提交回复
热议问题