2013-07-16 88 views
3

我一直使用標準的ISO日期時間格式插入到完整的日曆中。測試時,即使allDay字段設置爲false,我也無法將時間輸入日曆。以下是我的PHP代碼。FullCalender無法將時間插入日曆

$eventdt = date_format($eventdate,'c'); 
$eventet = date_format($eventend,'c'); 
$buildjson = array('id'=>"$eventtest",'title' => "$eventtest", 'start' => "$eventdt", 'end' => "$eventet", 'allDay' => 'false', 'backgroundColor' => "$eventc"); 
array_push($jsonArray, $buildjson); 
echo json_encode($jsonArray); 

這個代碼的輸出是

[{"id":"106","title":"106","start":"2013-07-17T11:00:00+02:00","end":"2013-07-18T14:00:00+02:00","allDay":"false","backgroundColor":"#FF0000"},{"id":"107","title":"107","start":"2013-07-19T10:45:00+02:00","end":"2013-07-20T14:15:00+02:00","allDay":"false","backgroundColor":"#FF0000"},{"id":"108","title":"108","start":"2013-07-22T10:45:00+02:00","end":"2013-07-22T14:15:00+02:00","allDay":"false","backgroundColor":"#FF0000"},{"id":"109","title":"109","start":"2013-07-22T10:45:00+02:00","end":"2013-07-22T14:15:00+02:00","allDay":"false","backgroundColor":"#D7DF01"}] 

我看到日期時間標籤有一個額外的加+2:00這是當地時區。當我試圖在腳本中手動插入值,時間越來越體現在日曆上

手動插入:

events: [ { 
       title: 'class5 meeting', 
       start: '2013-07-17T11:00:00', 
       end: '2013-07-18T14:00:00', 
       allDay: false, 
       backgroundColor: '#ff0000' 
       } 
      ] 

有沒有辦法,我可以修剪的日期,並在需要的值發送任何方式這樣的價值會被反映出來?

在此先感謝!

回答

2

我認爲問題可能是PHP生成的JSON中'allDay'字段的值爲,而FullCalendar期望Bool

嘗試改變$buildjson如下:

$buildjson = array('id'=>"$eventtest",'title' => "$eventtest", 'start' => "$eventdt", 'end' => "$eventet", 'allDay' => false, 'backgroundColor' => "$eventc");(注意:false沒有引號包圍)