【问题标题】:Event with specific day gets render in all days特定日期的事件在所有日期都呈现
【发布时间】:2020-07-13 23:29:26
【问题描述】:

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

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

我的代码:

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

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

谢谢!

【问题讨论】:

    标签: javascript fullcalendar fullcalendar-5


    【解决方案1】:

    您已将其指定为重复事件。删除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-objecthttps://fullcalendar.io/docs/v5/recurring-events 以了解单个事件与重复事件的区别和所需属性

    【讨论】:

    • 非常感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多