0
所以我花了過去2周試圖解決這個問題,並嘗試了所有其他以前提出的答案。我仍然無法做到。FullCalendar中的週期性事件
我試圖設置一個日曆,在指定的日期範圍內過濾週期性事件。 示例:「我的活動」 - 每週四下午2:15 - 2017/06/01和2017/06/30之間。
我已經嘗試過失敗提出了這個鏈接上的解決方案: Recurring Events in FullCalendar
在年底最後,我決定遵循這條路線: https://github.com/c-trimm/moment-recur
這是一個moments.js插件(矩易復發)應該處理日期範圍過濾器。
請幫忙!
我的JSON提要回報:
[{
"title":"my event",
"start":"2017-06-01T14:15",
"dow":"4",
"recurrence":"moment().recur[{
start:\"2017-06-01\",
end:\"2017-06-30\"}]"
}]
我的日曆的方式,除了一個事實,即它不會永遠停止發佈上週四的事件。我不想手動複製事件。
<link rel="stylesheet" type="text/css" href="/fullcalendar.css">
<script src='/jquery.min.js'></script>
<script src='/moment.min.js'></script>
<script src='/moment-recur.js'></script>
<script src='/fullcalendar.js'></script>
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,listWeek,listDay'
},
validRange: function(nowDate) {
return {
start: nowDate.clone().subtract(2, 'months'),
end: nowDate.clone().add(2, 'months')
};
},
// customize the button names,
// otherwise they'd all just say "list"
views: {
listDay: { buttonText: 'Day' },
listWeek: { buttonText: 'Week' },
},
hiddenDays: [ 5 ], // hide Fridays
editable: true,
eventLimit: true, // allow "more" link when too many events
businessHours: [ // specify an array instead
{
dow: [ 1 ], // Monday,
start: '12:30', // 8am
end: '22:00' // 6pm
},
{
dow: [ 2, 3 ], // Tuesday, Wednesday
start: '9:30', // 8am
end: '22:00' // 6pm
},
{
dow: [ 4, ], // Thursday
start: '13:00', // 10am
end: '22:00' // 4pm
},
{
dow: [ 7 ], // Sunday
start: '11:00', // 10am
end: '18:30' // 4pm
}],
events: 'my-event/feed',
//THIS IS WHERE I GET STUCK!!!!!
// I'm trying to implement this:
eventRender:
recurrence = moment().recur({
start: "01/01/2014",
end: "01/01/2015"
});
});
});
</script>
<div id='calendar'></div>
我認爲我猜想它寫一個函數,但沒有母校我做的嘗試,要麼剎車日曆或不返回任何結果。在此先感謝大家!
爲什麼https://stackoverflow.com/questions/15161654/recurring-events-in-ullcalendar中的解決方案不適合您?我已經成功地使用了它幾次 – ADyson