无法更新完整日历中的活动数据

时间:2015-11-12 10:15:30

标签: javascript fullcalendar

我使用fullcalendar.js这是我的代码:

      eventDrop: function(event, delta, revertFunc) {
    console.log(event.title + " was dropped on " + event.start.format() + "|" + event.end.format());
    event.start = moment(event.start.format());
    event.end = moment(event.end.format());
    console.log(event.start);
    console.log(event);
    $('#calendar').fullCalendar('updateEvent', event);
  },

同样你看,当我删除事件时,它将执行这个函数,event.start.format()打印新数据事件,但是当我打印event.start时,它仍然显示旧数据。所以我决定直接分配event.start = moment(event.start.format()),但是当我再次打印事件时,在firebug中检查它,因此事件变量的“start属性”没有改变,我很困惑为什么它那么?感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

Have a look at the moment docs - you've got it all screwy, which I'm guessing errors out your code and stops it from updating

console.log(event.title + " was dropped on " + moment(event.start).format());