【问题标题】:Fullcalendar 4 how to see if event is recurring from rruleFullcalendar 4如何查看事件是否从rrule重复发生
【发布时间】:2023-03-31 21:51:01
【问题描述】:

我正在使用 fullcalendar 版本 4 来插入/更新重复事件。我通过将 rrule 插入到我的数据库中,然后使用 rrule 插件为 fullcalendar 来显示它,成功地创建了重复事件。

当事件加载时,它们看起来像 JSON 示例:

 [{
 allDay: false
 color: "#2A2A2A"
 date_created: "2019-05-17 12:09:46"
 duration: "00:45:00"
 end: ""
 id: "23639"
 resourceId: "1"
 rrule: "DTSTART=20190514T111500Z;FREQ=DAILY;INTERVAL=1"
 start: ""
 textColor: "#FFFFFF"
 title: "BLOCK"
 }, 
 {
 allDay: false
 color: "#2A2A2A"
 date_created: "2019-05-17 12:09:46"
 duration: null
 end: "2019-05-15 11:45:00"
 id: "23639"
 resourceId: "1"
 rrule: null
 start: "2019-05-15 11:00:00"
 textColor: "#FFFFFF"
 title: "BLOCK2"
 }, 
 ]

如果存在规则,则重复事件会正确显示。

我现在正在研究一种更新/查看重复事件的方法。我需要捕捉事件,例如,当它们被移动/调整大小以开始时重复出现。

事件对象没有要检查的 rrule 属性。我正在尝试这个:

 eventClick: function(info) {
     if (info.event.rrule) {
      alert('this is a recurring event!');
      }
  }

... 但是,当单击重复事件时,不会显示示例警报。事件属性没有规则(它们不在 info.event.extendedProps 中)。

如何捕捉重复发生的事件以便我可以操纵它们?

我的下一步是捕获 RRULE 并将其转换为文本,以便用户可以阅读重复事件的设置方式。所以我对如何检索它有点困惑。

单击时从信息的console.log 中,我可以看到重复发生的事件的属性。 RRULE 不存在。它也不在 extendedProps 对象中。

allDay: (...)
allow: (...)
backgroundColor: (...)
borderColor: (...)
classNames: (...)
constraint: (...)
durationEditable: (...)
end: (...)
extendedProps: (...)
groupId: (...)
id: (...)
overlap: (...)
rendering: (...)
source: (...)
start: (...)
startEditable: (...)
textColor: (...)
title: (...)
url: (...)

【问题讨论】:

    标签: fullcalendar fullcalendar-scheduler fullcalendar-4


    【解决方案1】:

    您可以通过info.event._def.recurringDef 获取rrule 对象 该对象具有属性durationtypeDatatypeId typeData 属性包含实际的 RRule 对象

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多