eventResize后的fullcalendar不正确的事件结束日期 [英] fullcalendar incorrect event end date after eventResize

查看:221
本文介绍了eventResize后的fullcalendar不正确的事件结束日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

重新调整事件后,它会返回不正确的结束日期..我不明白为什么..

After resize an event, it returns an incorrect end date.. I don't understand why..

我正在使用此代码:

$('#calendar').fullCalendar({
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,basicWeek,basicDay'
    },
    defaultDate: '2014-11-07',
    editable: true,

    eventDrop: function(event){
        event.start._i = event.start.format();
    },
    eventResize: function(event) {
        event.end._i = event.end.format();
    },

    eventLimit: true, // allow "more" link when too many events
    events: [{
        id: 'All Day Event',
        title: 'All Day Event',
        start: '2014-11-03'
    }, {
        id: 'popo',
        title: 'popo',
        start: '2014-11-04T10:30:00',
        end:   '2014-11-05T12:30:00',
        description: 'This is a cool event'
    }, {
        id: 'popo2',
        title: 'popo2',
        //url: 'http://google.com/',
        start: '2014-11-06'
    }]
});

如果我简单地移动事件(拖放),它可以正常工作并正确返回开始日期,

If I simply move the event (drag & drop) it works fine and returns correctly the start date,

但是如果我调整事件大小,它会返回一个不正确的结束日期,

,并且开始日期也会变得不正确。

but if I resize the event, it returns an incorrect end date,
and also the start date becomes incorrect..

DEMO

推荐答案

我的答案来得晚,但正如在 this post ,event.start._i用于Moments.js的内部逻辑。

My answer comes late but as said in this post, the event.start._i is used for internal logic by Moments.js.

你的event.start确实包含你更新的​​日期(我认为它位于event.start_d),但你不需要使用这些内部对象,因为FullCalendar会考虑它们,并且会使用正确的(更新的)日期本身。

Your event.start does contain your updated date (which i think is located at event.start_d) but you don't need to use these internal objects as FullCalendar will take them into account and will use the correct (updated) date by itself.

这篇关于eventResize后的fullcalendar不正确的事件结束日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆