Reputation: 4523
How can I get fulldate of the specific position from eventDrop?
Fulldate Example:
Current Position: 2013-12-20
Dragged Position: 2013-12-11
I want Dragged Position in '2013-12-11' form. Is it possible ?
Here is my code:
// ----- This Paramenter is Used for Draging Events ------ //
eventDrop : function(event, delta) {
alert(delta);
// -- Right now its just providing days in '+' or '-'
// -- I want fulldate where it was dragged to: e.g 2013-12-11
}
Right now its just providing days in '+' or '-' .
I want fulldate where it was dragged to: e.g 2013-12-11
Upvotes: 1
Views: 1878
Reputation: 1
$(document).ready(function () {
eventDrop: function(event,revertFunc) {
var CurrentPositionDate= $.fullCalendar.formatDate(event.start, 'yyyy/MM/dd');
} });
Here currentPositionDate contain the date of current position date after drop event.
Just put this code in your script Its work for me....Thanks
Upvotes: 0
Reputation: 770
Updated Answer (to get the modified date of the event)
The modified date of the event is stored in the event.start
property of the event object that is passed into the eventDrop
callback. Basically, fullcalendar modifies the event object before invoking the callback.
Previous Answer (to get the original date of the event)
I haven't been able to find a way to directly access the original date from the eventDrop callback, since fullcalendar has already modified the event date.
I use the following workaround:
(function() {
var originalDate;
$('#calendar').fullCalendar({
// Always called before eventDrop
eventDragStart: function(event) {
originalDate = new Date(event.start); // Make a copy of the event date
},
eventDrop: function(event, dayDelta, minuteDelta) {
alert( 'Event dropped! Original date = ' + originalDate );
}
}
})();
As shown in the code, the idea is just to tuck away the original date in the eventDragStart callback that is guaranteed to be called before the event drop callback.
Upvotes: 1