最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Fullcalendar show "end date" one day off - Stack Overflow

programmeradmin3浏览0评论

Fullcalendar show "end date" one day off
json is jan 12th, to 16th, but the calendar show 12th to 15th here is the code

var calCon = $('.cal');
calCon.fullCalendar({
    prev: 'left-single-arrow',
    firstDay: 1,
    weekends:true,
    weekNumbers:true,
    ignoreTimezone:false,
    allDayDefault:true,
    weekNumberCalculation:"ISO",
    defaultView:"basicWeek",
    timeFormat: 'H(:mm)',
    events: {
        url: "/calendarjson.xsp",
        cache: false
    }
})

here is the json

[{"color":"#3a87ad","id":"123","allday":"1","url":"/...","end":"2015-01-16T10:00:00.0+0100","start":"2015-01-12T09:00:00.0+0100","title":"Thomas Adrian"}]

I am using allDayDefault because time is not important.
What am I doing wrong?

I am using the latest fullcalender 2.2.5
I have tried to change the time but it is still the same

Fullcalendar show "end date" one day off
json is jan 12th, to 16th, but the calendar show 12th to 15th here is the code

var calCon = $('.cal');
calCon.fullCalendar({
    prev: 'left-single-arrow',
    firstDay: 1,
    weekends:true,
    weekNumbers:true,
    ignoreTimezone:false,
    allDayDefault:true,
    weekNumberCalculation:"ISO",
    defaultView:"basicWeek",
    timeFormat: 'H(:mm)',
    events: {
        url: "/calendarjson.xsp",
        cache: false
    }
})

here is the json

[{"color":"#3a87ad","id":"123","allday":"1","url":"/...","end":"2015-01-16T10:00:00.0+0100","start":"2015-01-12T09:00:00.0+0100","title":"Thomas Adrian"}]

I am using allDayDefault because time is not important.
What am I doing wrong?

I am using the latest fullcalender 2.2.5
I have tried to change the time but it is still the same

Share Improve this question edited Jan 15, 2015 at 10:15 Thomas Adrian asked Jan 15, 2015 at 10:05 Thomas AdrianThomas Adrian 3,6366 gold badges36 silver badges65 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 13

FullCalendar.js uses exclusive end moments. The documentation says it here. It means that the end moment of an event does not belong to the time interval from start to end, but marks the point in time right after that interval.

The important point here is that you set default for allDay to true. You use 2015-01-16T10:00:00.0+0100 as endpoint for the event. But an allDay event does NOT keep time information internally in fullCalendar. It strips off the time and only keeps the date. You use 2015-01-16T10:00:00.0+0100 as endpoint. The time is stripped and end is made exclusive which results in 2015-01-15T23:59:59.0+0100, what is the result you see in your fullCalendar. You should have used 2015-01-17T00:00:00.0+0100 as end for your allDay event, to have it span to January 16th 23:59:59.

发布评论

评论列表(0)

  1. 暂无评论