Anatoly
Anatoly

Reputation: 5243

Why does FullCalendar renders this event as single day event?

This is JSON representation of event:

    "id" : 253,
    "title" : "16-17",
    "allDay" : true,
    "start" : "2015-04-16T00:00:00.000+03:00",
    "end" : "2015-04-17T00:30:00.000+03:00"

FullCalendar renders it as single day event. I suspect that the problem is in timezone settings, but can't understand what exactly.

I've tried to use: ignoreTimezone: false but it didn't help.

I suppose that JSON above will render full day event from 16th to 17th (two day event).

Thank you.

UPDATE: I'm using FullCalendar v2.3.1 and there's a link to jsfiddle which reproduces this issue: http://jsfiddle.net/anatoly314/m8d68v1b/4/

Upvotes: 0

Views: 291

Answers (1)

S McCrohan
S McCrohan

Reputation: 6693

None of the automated tests in the current version of FullCalendar appear to cover the case in which the start and end dates include times AND the allDay option is set.

Documentation indicates that end dates are exclusive. I strongly suspect that what is happening is that with allDay : true, fullCalendar is stripping the times off of the start and end dates and treating them as T00:00:00. At that point, your event has a start time of 2015-04-16T00:00:00.000 and an end time of 2015-04-17T00:00:00.000, which matches the behavior you're seeing. In fact, if you omit the times from your data and give it:

start: '2015-04-16',
end: '2015-04-17'

it produces a one-day event.

It looks like if you want your event to span two days, you'll need to 'round up' your end time to the beginning of the next day.

Upvotes: 1

Related Questions