[英]Fullcalendar jquery plugin recurring event day/week number in month
I'm trying to display the menu of a refectory by the plugin FullCalendar. 我正在尝试通过插件FullCalendar显示餐厅的菜单。 The menu should be something like that:
菜单应该是这样的:
etc.. 等等..
I need to recurring event in this way.. But I don't know if it's possible and how implement it.. I'm so confused. 我需要以这种方式重复发生事件。.但是我不知道这是否可能以及如何实现。.我很困惑。
At the moment my code will look something like that: 目前,我的代码将如下所示:
var date = new Date();
var d = date.getDate();
var m = date.getMonth();
var y = date.getFullYear();
$('#calendar').fullCalendar({
events: [
{ start: new Date(y, m, 1), title: 'Pasta all\'olio e parmigiano' },
{ start: new Date(y, m, 2), title: 'Pasta all\'olio e parmigiano' },
...
Is there a way to set the correct date and recurring in Fullcalendar as I need, using javascript date() function, or by mixing with another technologies (PHP/MySQL..)? 有没有一种方法可以设置正确的日期并根据需要在全日历中使用javascript date()函数,或者通过与其他技术混合使用(PHP / MySQL ..)?
Thanks in advance. 提前致谢。
I think there are two options: 我认为有两种选择:
Create a Google Calendar, which supports this kind of recurring events, and add it to fullcalendar as shown here : 创建一个谷歌日历,支持这种经常性的活动,并把它添加到fullcalendar如图所示在这里 :
<script type='text/javascript' src='fullcalendar/gcal.js'></script> <script type='text/javascript'> $(document).ready(function() { $('#calendar').fullCalendar({ events: 'http://www.google.com/your_feed_url/' }); }); </script>
Calculate the event on dates your own, as fullcalendar doesn't support recurring events. 由于全日历不支持重复发生的事件,因此请按您自己的日期计算事件。 You can use the datejs library as a little help:
您可以使用datejs库作为一点帮助:
<script type='text/javascript' src='date.js'></script> <script type='text/javascript'> function getRecurrences(date, count) { var nthOccurence = Math.ceil((date.getDate() - date.getDay()) / 7), dates = [date]; for(var i = 0; i < count; i++) { var nextDate = dates[dates.length - 1].clone().addMonths(1); nextDate.moveToNthOccurrence(date.getDay(), nthOccurence); dates.push(nextDate); } return dates; } var date = new Date(2013, 8, 18); // 3rd Wednesday var nextThreeOccurences = getRecurrences(date, 3); </script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.