Simon
Simon

Reputation: 227

FullCalendar not displaying event times - fed from CFC

I've seen this asked (and answered) a number of times, but thus far none of the solutions is working for me.

I have a cfc that returns json data to an instance of FullCalendar.

The returned data looks like this:

[{"id":2,"title":"Test Event One","start":"February, 17 2011 09:30:00","end":"February, 17 2010 10:30:00","allday":false}]

The event is showing on the right day in all the calendar views - but is showing up in the all day section.

I'm invoking the calendar like this:

$('#calendar').fullCalendar({
    editable: true,
    events:'getEvents.cfc?method=getEvents&returnformat=json',
    header: {
        right: '',
        center: 'prev,next today',
        left: 'agendaDay,agendaWeek,month,'
        }

I'd really appreciate any help with this - Thanks

Upvotes: 0

Views: 1991

Answers (2)

Rafael
Rafael

Reputation: 11

This is what I did on the jason-event.php and it worked

<?php

$year = date('Y');
$month = date('m');

echo json_encode(array(
    //May
    array(
        'id' => 1,
        'title' => 'Cardio-Kick Boxing and Adult Kung Fu ONLY',
        'start' => '2011-05-28 9:30:00',
        'end' => '2011-05-28 12:00:00',
        'allDay' => false,
        'url' => 'http://maxfit.us/'
    ),
));

?>

Upvotes: 1

Dan Short
Dan Short

Reputation: 9616

It doesn't appear that you're returning the date in the format the fullCalendar object expects. Looking at the Event Object documentation, you need to return the dates in the following formats:

start: Date A JavaScript Date object indicating the date/time an event begins.

When specifying Event Objects for events or eventSources, you may specify a string in IETF format (ex: "Wed, 18 Oct 2009 13:00:00 EST"), a string in ISO8601 format (ex: "2009-11-05T13:15:30Z") or a UNIX timestamp.

Upvotes: 0

Related Questions