I think the reason is that FullCalendar places the title during the div when there is not enough space to display the title on a separate line (which usually happens when the event spans 30 minutes). When the time and title are placed in the same div, FullCalendar only passes the start time of the date formatting.
To do this, you can change the line number 4020 in fullcalendar.js (v. 1.6.1) from:
eventElement.find('div.fc-event-time') .text(formatDate(event.start, opt('timeFormat')) + ' - ' + event.title);
to
eventElement.find('div.fc-event-time') .text(formatDates(event.start, event.end, opt('timeFormat')) + ' - ' + event.title);
If you don't want to change the source code of FullCalendar, you can look at the eventRender callback eventRender .
Updated Answer
It is probably best to fix this without changing the source code of FullCalendar, and in fact it’s pretty simple to do it in the “right way”. However, eventRender not very useful, because FullCalendar destroys the time and title after this callback, and our changes will be overwritten.
Fortunately, there is another eventAfterRender that you can use:
eventAfterRender: function(event, $el, view) { var formattedTime = $.fullCalendar.formatDates(event.start, event.end, "HH:mm { - HH:mm}"); // If FullCalendar has removed the title div, then add the title to the time div like FullCalendar would do if($el.find(".fc-event-title").length === 0) { $el.find(".fc-event-time").text(formattedTime + " - " + event.title); } else { $el.find(".fc-event-time").text(formattedTime); } }
Here is a jsfiddle example: http://jsfiddle.net/kvakulo/zutPu/
Regin larsen
source share