uses fullCalendar to make a simple work day and rest day scheduling function, because the current company is in the mode of small and small holidays, that is, one week, two days and one week, a single day. Set whether to go to work to the title of the event, the events from the background:
1 //Get the data and display it on the fullcalendar page
2 events: function(start, end, callback) {
3 var fstart = moment(start).format("yyyy-MM-dd");
4 var fend = moment(end).format("yyyy-MM-dd");
5 $.ajax({
6 type: "post",
7 url: "/system/getWorkdayInfos",
8 dataType: "json",
9 data: {
10 start: fstart,
11 end: fend
12 },
13 success: function(data) {
14 if (data.success) {
15 var events = [];
16 $.each(data.data, function(i) {
17 var status = data.data[i].workStatus==1?"in":"out";
18 events.push({
19 title: status,
20 start: moment(data.data[i].date).format("YYYY-MM-DD"),
21 end: moment(data.data[i].date).format("YYYY-MM-DD"),
22 allDay: true
23 });
24 });
25 callback(events);
26 } else {
27 alert(data.description);
28 }
29 }
30 });
31 },
always returns an error:
search found himself with fullcalendar version of events method lacks a parameter: timezone,
After adding this parameter, sure enough, no more errors are reported. The correct events method is defined as :
events: function(start, end, timezone, callback) {
...
}