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 !