特定日期的事件会在所有日期呈现

Event with specific day gets render in all days

我正在使用全日历,我想将一个事件添加到特定的日期和时间,但该事件会在所有日期呈现。 (时间段有效)

我查看了所有文档,但没有发现任何错误。

我的代码:

var calendar = new FullCalendar.Calendar(calendarEl, {
  events: [{ // My event
    title: 'The Title',
    start: '2020-08-05',
    end: '2020-08-06',
    startTime: '09:00:00',
    endTime: '10:00:00',
    allDay: false
  }],
  contentHeight: 'auto',
  initialDate: new Date('2020-08-01'),
  validRange: {
    start: '2020-08-01',
    end: '2020-08-18'
  },
  titleFormat: { year: 'numeric', month: 'long', day: 'numeric' },
  headerToolbar: {
    start: 'title',
    center: '',
    end: 'prev,next'
  },
  initialView: 'timeGridWeek',
  slotDuration: '01:00:00',
  slotMinTime: '09:00:00',
  slotMaxTime: '18:00:00',
  weekends: false,
  locale: 'es',
  allDaySlot: false,
});

这是我的带有错误的代码笔和我正在使用的代码!
https://codepen.io/alfijuan/pen/yLeqwer?editors=1010

希望大家帮帮忙!

谢谢!

您已将其指定为周期性事件。删除 startTimeendTime 属性并将时间数据与日期一起合并到 startend 属性中。

{
  title: 'The Title',
  start: '2020-08-05 09:00:00',
  end: '2020-08-06 10:00:00',
  allDay: false
}

演示:https://codepen.io/ADyson82/pen/ZEQMEvY

请参阅 https://fullcalendar.io/docs/v5/event-object and https://fullcalendar.io/docs/v5/recurring-events 以了解单个事件与重复事件的区别和所需属性