完整的日历以显示当前周和下周

时间:2019-03-03 15:44:06

标签: php fullcalendar

我正在使用完整的日历来显示我的事件,此时我具有显示最后一周和当前周的默认视图,但是我希望用户仅显示日历中的本周和下周 下面我附上了我的代码。

<script>

$(document).ready(function () {
    var calendar = $('#calendar').fullCalendar({
         views: {
            agendaWeek: {
                type: 'agenda',
                duration: {weeks: 3},
                rows: 2
            }
        },
		header: {
			left: '',
			center: 'title',
			right: 'agendaWeek'
		},
		navLinks: true, // can click day/week names to navigate views
		editable: true,
                defaultView: 'agendaWeek',
                 minTime: '13:00:00', /* calendar start Timing */
        maxTime: '24:00:00',  /* calendar end Timing */
                
                
		eventLimit: true,
        events: "load_Emp_Roster.php",
        displayEventTime: true,
        eventRender: function (event, element, view) {
            if (event.allDay === 'true') {
                event.allDay = true;
            } else {
                event.allDay = false;
            }
        },
       selectable: true,
        selectHelper: true,
       select: function (start, end, allDay) {
      
            calendar.fullCalendar('unselect');
        }, 
        
    

    });
});

function displayMessage(message) {
	    $(".response").html("<div align='center' style='padding:20px;font-size:18px;color:#3539EA' class='success'>"+message+"</div>");
    setInterval(function() { $(".success").fadeOut(); }, 2000);
}
</script>

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

看看https://fullcalendar.io/docs/visibleRange

我会添加这样的内容(请注意,我尚未测试过):

visibleRange: function(currentDate) {
  return {
    start: currentDate.clone(),
    end: currentDate.clone().add(2, 'weeks')
  };
}