我已经成功使用fullcalendar插件几个月了,突然遇到了一个bug。它不会在2012年3月31日显示事件。这种行为不会发生在我们运行php v5.3.8的测试站点服务器上,而是在我们的实时站点服务器上。该服务器正在运行php v5.3.6。
有人可以对这种情况有所了解。它可能与夏令时有关吗?我该如何解决这个问题?
感谢您的帮助。
CODE:
<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;
?>
答案 0 :(得分:2)
$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**
答案 1 :(得分:1)
查看两个事件源的JSON响应,我无法看到3月31日发生的事件。
您的问题很可能是在服务器端查询事件或事件记录本身,而不是FullCalendar。