How to display end time on oneslot events with Fullcalendar?

How to display end time on oneslot events? I want one slot events to show start and end like the longer events(12.00-12.30). Already tried using timeFormat but that didn't help. Using select to make new events. Oneslot events have end on database but it's not showing on the calendar for some reason.

Problem is that when user clicks the calendar it creates event that has start and end but for some reason only start shows on the calendar (lower event on picture) but when user selects larger area like 1h it shows start and end on the calendar (first event).

Those events that don't show end on the calendar seem to break the for--if in select. After creating 30 min long event user can make overlapping events.

Picture with the problem:

$('#calendar').fullCalendar({
    header: {
        left: 'prev,next today',
        center: 'title',
        right:''
    },
    allDaySlot: false,
    allDayDefault:false,
    lang: currentLangCode,
    slotEventOverlap:false,
    minTime:"09:00:00",
    maxTime:"15:00:00",
    hiddenDays:[6,0],
    lazyFetching:true,
    selectable: true,
    selectHelper: true,
    aspectRatio:3.15,

    select: function(start, end) {

        check_time=false;
        var events = $("#calendar").fullCalendar('clientEvents');

        if(moment(start._d).format('YYYY/MM/DD')== moment(end._d).format('YYYY/MM/DD')){
            overnight=true;
        }
        else{
            overnight=false;
        }

        if(events.length>0){
            for(var i in events)
            {
                //prevent overlapping events
                if(
                    ((moment(events[i].start._d).format('YYYY/MM/DD/HH/mm')) == (moment(start._d).format('YYYY/MM/DD/HH/mm'))) || 
                    (((moment(events[i].start._d).format('YYYY/MM/DD/HH/mm')) < (moment(end._d).format('YYYY/MM/DD/HH/mm')))&& 
                    ((moment(events[i].end._d).format('YYYY/MM/DD/HH/mm')) > (moment(start._d).format('YYYY/MM/DD/HH/mm')))) ||
                    (((moment(events[i].start._d).format('YYYY/MM/DD/HH/mm')) > (moment(start._d).format('YYYY/MM/DD/HH/mm'))) &&
                    ((moment(events[i].start._d).format('YYYY/MM/DD/HH/mm')) < (moment(end._d).format('YYYY/MM/DD/HH/mm')))) ||
                    (((moment(events[i].start._d).format('YYYY/MM/DD/HH/mm')) > (moment(start._d).format('YYYY/MM/DD/HH/mm'))) &&
                    ((moment(events[i].end._d).format('YYYY/MM/DD/HH/mm')) < (moment(end._d).format('YYYY/MM/DD/HH/mm'))))
                ){ 
                    check_time=false;
                }
                else{
                    check_time=true;
                }
                i++;
            }
        }  
        else{
            check_time=true;
        }

        $("#dialog").dialog("open");
        startstamp=moment(start).unix();
        endstamp=moment(end).unix();
        starttime=moment(start).toISOString();
        endtime=moment(end).toISOString();   
        $('#calendar').fullCalendar('unselect');
    }, 
    defaultView: 'agendaWeek',      
    editable: false,
    events:/events.php

});
链接地址: http://www.djcxy.com/p/81266.html

上一篇: 事件显示错误的结束日期为一天

下一篇: 如何使用Fullcalendar在onelot事件中显示结束时间?