0

我正在使用 fullcalendar,我想将事件添加到特定的日期和时间,但该事件会在所有日子里呈现。(时隙有效)

我浏览了所有文档,但找不到任何错误。

我的代码:

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

希望任何人都可以提供帮助!

谢谢!

4

1 回答 1

1

您已将其指定为重复事件。删除startTimeandendTime属性并将时间数据与日期一起合并到startand属性中。end

{
  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-objecthttps://fullcalendar.io/docs/v5/recurring-events以了解单个事件与重复事件所需的区别和属性

于 2020-07-14T08:21:47.300 回答