本文介绍了fullCalendar没有显示正确的结束日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看官方FullCalendar网站的

此代码有什么问题?

解决方案

不要将日期视为离散的日期,而是时间上的连续时间.日期 2015-09-30 隐式地指定了时间 00:00:00 ,即午夜.这意味着该事件实际上不会扩展到30日,而只是在当天开始的时候.

这为您提供了一个简单的解决方案.一天后结束活动:

 结尾:"2015-10-01" 

或者,从文档中获取:

I am looking at the debug page of the official FullCalendar site. I want to schedule an event from 22/09/2015 to 30/09/2015 (dd/mm/yyyy). But it only shows up for dates from 22/09/2015 to 29/09/2015 - 30/09/2015 is missing.

Here is the code:

$(function() { // document ready
   $('#calendar').fullCalendar({
     header: {
       left: 'prev,next today',
       center: 'title',
       right: 'month,agendaWeek,agendaDay'
     },
     defaultDate: '2014-11-12',
     editable: true,
     eventLimit: true, // allow "more" link when too many events
     events: [
        {
          title: 'Meeting',
          start: '2015-09-22',
          end: '2015-09-30'
        }
     ]
   });
});

Here is an image of the output:

What is the problem with this code?

解决方案

Don't think of the dates as discrete days, but as a continium in time. The date 2015-09-30 is implicitly given the time 00:00:00, i.e. midnight. This means that the event will not actually extend to the 30th, but en just when that day starts.

This gives you a simple solution. Just end the event one day later:

end: '2015-10-01'

Or, take it from the documentation:

这篇关于fullCalendar没有显示正确的结束日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 12:03
查看更多