2
votes

I am currently using jQuery FullCalendar as a calendar system, and it is working quite fine for all my needs. However, I have noticed one issue that I cannot seem to resolve on my own, and I'm not quite sure how to fix this.

The majority of my events are stored in the database like this (and work fine):

start                                  end
--------------------                   --------------------    //e.g., 2 days long
2012-02-17T09:00:00                    2012-02-19T09:00:00

My question/issue is: Whenever I have an event that spans across several months, the event is not rendered, for example:

start                                  end
--------------------                   --------------------    //e.g., 2 Months long
2012-02-17T09:00:00                    2012-04-17T09:00:00

I think this may have something to do with whenever the parameters are sent, it sends the "first" day on the calendar viewport and the "last" day. However, if my event spans over two months, for some reason the calendar cannot render the event.

I hope this makes sense. Any help on this would be great.

Thanks!

EDIT: Sorry I did not include my query.

Using the event above (starting on Feb 17th and ending on April 17th).

Say you are looking at the month of February, FullCalendar sends the start and end parameters:

startParam
2012-01-29 00:00:00  //converted from UNIX

endParam
2012-03-04 00:00:00  //converted from UNIX

So my query currently looks like this:

SELECT event_title FROM events
WHERE start >= 2012-01-29 00:00:00 AND end <= 2012-03-04 00:00:00

The problem is, the "start" and "end" of my actual event (2012-02-17) and (2012-04-17) don't fall within the conditions of the query above.

What would be the best way to change my query to show a long event?

Thanks!

1
@Dodinas, FullCalendar handles events spanning multiple events just fine. Are you sure that your own query that retrieves the event information from the DB is correct? Can you post your query? What is the JSON response response that you are returning to FullCalendar?Brandon
@Brandon, Good call. I totally forgot to add my query. I went ahead and updated the question. Thank you.Dodinas
Well, 2012-04-17T09:00:00is not less than 2012-03-04 00:00:00.alexn

1 Answers

2
votes

Your query should be

SELECT ... FROM events
WHERE end > 2012-01-29 00:00:00 OR start < 2012-03-04 00:00:00

That gives you all events which overlap at all the period being requested.