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