2
votes

I'm working with a fullCalendar and I want to get the "end" property value for an event after resizing it like this:

enter image description here

for this first event "gaming day" I get start = Mon Aug 01 2016 01:00:00 GMT+0100 (WEST) and end = Wed Aug 02 2016 01:00:00 GMT+0100 (WEST) how can I get the the value of end after resizing my event manually enter image description here this is my code :

$scope.listEvents = [{
        title: 'Gaming Day',
        start: '2016-08-13T12:00:00',
        end: '2016-08-15T00:00:00',
        color: #9b59b6,
        allDay: true
    }, {
        title: 'Live Conference',
        start: new Date(y, m, 3)
    }, {
        title: 'Top Secret Project',
        start: new Date(y, m, 4),
        end: new Date(y, m, 8),
        color: '#1abc9c'
    }];

    $('#calendar').fullCalendar({
        header: {
            left: 'prev,next',
            center: 'title',
            right: 'month,agendaWeek,agendaDay'
        },
        firstDay: 1,
        editable: true,
        droppable: true,
        drop: function(date, allDay) { // this function is called when something is dropped
            // retrieve the dropped element's stored Event Object
            var originalEventObject = $(this).data('eventObject');

            // we need to copy it, so that multiple events don't have a reference to the same object
            var copiedEventObject = $.extend({}, originalEventObject);

            // assign it the date that was reported
            copiedEventObject.start = date;
            // render the event on the calendar
            // the last `true` argument determines if the event "sticks" (http://arshaw.com/fullcalendar/docs/event_rendering/renderEvent/)
            $('#calendar').fullCalendar('renderEvent', copiedEventObject, true);

            // remove the element from the "Draggable Events" list
            $(this).remove();
        },
        events: $scope.listEvents,
        eventDrop: function(event, delta, revertFunc) {
            /* After a drag and drop of my event I get the new position with this */
            console.log(event.title);
            if (event.start) console.log(event.start._d);
            if (event.end) console.log(event.end._d);
        }
    });

So after resizing the event how can I get the new end date?

1

1 Answers

1
votes

Use the eventResize property:

function eventResize(event, delta, revertFunc) {
    var endDate = event.end.format().toString();
    var startDate = event.start.format().toString();
}

And in the calendar config add the reference to the function:

header: {...},
eventResize: eventResize