我已经成功使用fullcalendar插件几个月了,但突然遇到了一个bug。它不会在2012年3月31日举办任何活动。这种行为不会发生在我们运行phpv5.3.8的测试站点服务器上,但会发生在我们的实时站点服务器上。该服务器运行的是php v5.3.6。
有人能解释一下这种情况吗。这可能与夏令时有关吗?我该如何解决这个问题?
谢谢你的帮助。
代码:
<script type="text/javascript">
$(document).ready(function() {
$('#calendar').fullCalendar({
theme: "true",
aspectRatio: 1.8,
weekMode: 'liquid',
header: {
left: "",
center: "prev title next",
right: ""
},
buttonIcons:{
prev: "triangle-1-w",
next: "triangle-1-e"
},
eventSources: [
{
url: 'VS_race_events.php', // Event Source One //
type: 'POST',
error: function() {
alert('there was an error while fetching events!');
},
color: '#006600',
textColor: 'white'
},
{
url: 'VS_work_events.php', // Event Source Two //
type: 'POST',
error: function() {
alert('there was an error while fetching events!');
},
borderColor: '#006600',
color: 'beige',
textColor: '#333333'
}
],
eventClick: function(calEvent, jsEvent, view) {
$("#dialog_frame").css("visibility", "visible");
$("#dialog_frame").draggable("enable");
$(".dialog_content").html(calEvent.description);
$(".dialog_title").html(calEvent.title);
}
})
});
</script>
这是VS_work_event文件:
<?php
require_once('Connections/HDAdavePDO.php');
if (isset($_POST['start'])) {
$unix_start = $_POST['start'];
$date_start = strftime("%Y-%m-%d",$unix_start);
}
if (isset($_POST['end'])) {
$unix_end = $_POST['end'];
$date_end = strftime("%Y-%m-%d",$unix_end);
}
$pdo = new PDO('mysql:host=' . $host . ';dbname='.$database, $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt2 = $pdo->prepare('SELECT * FROM vs_events WHERE event_date >= ? AND event_date < ?');
$stmt2->bindParam(1, $date_start);
$stmt2->bindParam(2, $date_end);
$stmt2->execute();
$stmt2->setFetchMode(PDO::FETCH_ASSOC);
$row_Calendar = $stmt2->fetchAll();
foreach ($row_Calendar as $row){
if ($row['event_type'] == 13 && $row['active'] == 1){
$display_date = substr($row['event_date'],0,10);
$eventsArray['id'] = $row['event_id'];
$eventsArray['start'] = $display_date;
$eventsArray['title'] = $row['event_subject'];
$eventsArray['description'] = $row['event_text'];
$eventsArray['type'] = $row['event_type'];
$events[] = $eventsArray;
}
}
echo json_encode($events);
$pdo = null;
?>
$stmt2 = $pdo->prepare('SELECT * FROM vs_events WHERE event_date >= ? AND event_date < ?');
因此,如果$date_end是3月31日,则此查询不会将3月31号事件作为返回
31st March < 31st March is **false**
查看两个事件源的JSON响应,我看不到发生在3月31日的事件。
您的问题可能是服务器端查询事件或事件记录本身,而不是FullCalendar。