嗨,朋友,我在项目laravel 5.6中使用maddhatter fullcalendar,当我在日历中获取数据时,其数据按数据包含ymd格式,但是当我将格式更改为datetime时,我的日历未显示此代码:< / p>
$events = Agenda::where('code_commercial', $code)->get();
$event_list = [];
foreach ($events as $event) {
$event_list[] = Calendar::event(
$event->description,
true,
date_format(date_create($event->date_debut), "Y-m-d H:i:s"),
date_format(date_create($event->date_fin), "Y-m-d H:i:s")
// new \DateTime($event->date_debut),
// new \DateTime($event->date_fin),
// Carbon::createFromFormat('Y-m-d H:i:s', $event->date_debut)->toDateTimeString(),
// Carbon::createFromFormat('Y-m-d H:i:s', $event->date_fin)->toDateTimeString()
);
}
这是我的全日历配置:
$calendar_details = Calendar::addEvents($event_list, [ //set custom color
fo this event
'color' => '#800',
])->setOptions([ //set fullcalendar options
'firstDay' => 1,
'selectable' => true,
'defaultView' => 'agendaWeek',
'allDay' => false,
'slotLabelFormat' => 'HH:mm:ss',
'editable' => true,
'eventLimit' => true,
// 'minTime' => '07:00:00',
// 'maxTime' => '22:00:00',
// 'slotDuration' => '01:30:00',
])
请帮助您