Event Spanning Multiple Months

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!


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.

链接地址: http://www.djcxy.com/p/81224.html

上一篇: Fullcalendar:日程视图中的重复项

下一篇: 跨越多个月的事件