0

i used fullcalendar v5 with external events that i can dropped on the calendar.

I have an issue and i don't understand what i'm doing wrong...

When i drag and drop an event, the drop function(info, date) return the curent date and not the date where the event was dropped.

/* initialize the external events
-----------------------------------------------------------------*/
var containerEl = document.getElementById('external-events-list');
new FullCalendar.Draggable(containerEl, {
itemSelector: '.fc-event',
eventData: function(eventEl) {
    return {
        title: eventEl.innerText.trim()
    }
}
});

drop: function(info,date) {         
console.log(moment(date).format('YYYY-MM-DD HH:mm:ss'));
$('#ModalAdd #start').val(moment(date).format('YYYY-MM-DD HH:mm:ss'));
$('#ModalAdd #end').val(moment(date).format('YYYY-MM-DD HH:mm:ss'));
$('#ModalAdd #task').val(info.draggedEl.innerText);
$('#ModalAdd').modal('show');
},

As you can see on the picture, the date in console.log or the date in the fields "start" and "end" on the form of the modal window are the current date...

I dont't understand....

Thank you !

screenshot

Flucktuken
  • 29
  • 5
  • `date` is null, so momentJS will use the current date instead. Why is `date` null? Read the docs carefully: https://fullcalendar.io/docs/v5/drop and it should be obvious – ADyson Jul 27 '20 at 10:29
  • 1
    thank you for your answer....I'm so stupid...only one parameter for drop :function(info) and then use info.date. – Flucktuken Jul 27 '20 at 16:00

0 Answers0