FullCalender无法在日历中插入时间



我一直在使用标准的ISO日期-时间格式来插入完整的日历。在测试它时,我无法在日历中输入时间,即使allDay字段设置为false。以下是我的php代码。

$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"}]

我看到datetime标签增加了+2:00,这是本地时区。当我尝试在脚本中手动插入值时,时间会反映在日历上

手动插入:

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

有没有什么方法可以修剪日期并发送所需的值,以便反映这些值?

提前感谢!

我认为问题可能是PHP生成的JSON中"allDay"字段的false值是String,而FullCalendar需要Bool

尝试按如下方式更改$buildjson

$buildjson = array('id'=>"$eventtest",'title' => "$eventtest", 'start' => "$eventdt", 'end' => "$eventet", 'allDay' => false, 'backgroundColor' => "$eventc");(注意false没有用引号括起来)

相关内容

  • 没有找到相关文章

最新更新