简体   繁体   English

Fullcalendar 多月事件

[英]Fullcalendar Multi-Month Event

I'm using FullCalendar and have an event that spans all summer (May through August).我正在使用 FullCalendar 并且有一个跨越整个夏天(5 月到 8 月)的活动。 The event is being pulled into the calendar as when I change the dates to a smaller range it works.当我将日期更改为较小的范围时,该事件被拉入日历。

I was wondering if there is a way to span a single event multiple months.我想知道是否有办法跨越多个月的单个事件。 Basically it would show up from May 24th - August 30th across every day and week.基本上它会在每天和每周的 5 月 24 日至 8 月 30 日期间出现。

I only want one month showing at a time though.不过,我只想一次显示一个月。

You can achieve what you would like to by supplying an end value for the event:您可以通过为事件提供end值来实现您想要的:

document.addEventListener('DOMContentLoaded', function() {
  var calendarEl = document.getElementById('calendar');
  var calendar = new FullCalendar.Calendar(calendarEl, {
    events: [{title: 'Very long event', start: '2021-05-24', end: '2021-08-31'}],
  });
  calendar.render();
});

It is important to note that for the event to display on the final day of the event you need to either add an extra day to the event value (as I have) or specify an end time eg 2021-08-31 18:00:00 .需要注意的是,要在事件的最后一天显示事件,您需要在事件值中添加额外的一天(如我所愿)或指定结束时间,例如2021-08-31 18:00:00 .

Here is a Pen so you can see it working.这是一支,您可以看到它在工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM