日历上的重复事件:RFC 5545 Javascript 解析

发布于 2024-12-15 06:37:40 字数 275 浏览 2 评论 0 原文

我需要将重复发生的事件集成到完整日历的改编版本中,该版本添加了允许离线事件浏览的 JavaScript 模块。

我正在寻找一个可以根据 RFC 5545 解析重复事件的 javascript 库。

我需要能够列出 2 个日期(开始日期和结束日期)之间发生的所有重复事件,使用 RRULE 和 EXDATE 并解释每日、每周,每月和每年的复发。

我花了几个小时寻找一些没有 aval 的东西,我不想重新发明轮子......任何人都可以为我指出现有 javascript 解析器的正确方向吗?

I need to integrate recurring events into an adapted version of full-calendar that has an added javascript module which allows offline event browsing.

I'm looking for a javascript library that can parse recurring events according to RFC 5545.

I need to be able to list all recurring events that occur between 2 dates (start date and end date), using RRULE and EXDATE and interpreting daily, weekly, monthly and yearly recurrences.

I've spent hours searching for something to no aval, and I don't want to reinvent the wheel....Can anyone please point me in the right direction for an existing javascript parser?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

£噩梦荏苒 2024-12-22 06:37:40

我检查了 skyporters rrule_parser 并发现它不支持所有规则(特别是它不能正确执行 BYDAY)。我找到了一个很棒的替代方案:

https://github.com/jakubroztocil/rrule

他们正在积极支持这个库,并有一个很棒的演示网站,显示了所有功能。您可以从 5545 格式或纯文本(使用 nlp 扩展)进行解析。它功能丰富,据我所知,功能齐全。

I checked into skyporters rrule_parser and found that it doesn't support all of the rules (particularly, it won't do BYDAY properly). I found a fantastic alternative:

https://github.com/jakubroztocil/rrule

They are actively supporting this library and have a great demo website that shows all of the functionality. You can parse from either 5545 format or plain text (using the nlp extension). It is feature packed and, as far as I can tell, fully functioning.

多情出卖 2024-12-22 06:37:40

查看https://github.com/skyporter/rrule_parser

我希望它能帮助你。

look into https://github.com/skyporter/rrule_parser.

I hope it will help you.

玩心态 2024-12-22 06:37:40

这是 jquery 的重复小部件,它解析/创建 RFC5545 兼容的重复字符串。

https://github.com/collective/jquery.recurrenceinput.js

它不会扩展不过,将重复规则转化为发生日期。但它包含一个 python 服务器,可以使用 python-dateutil 为您完成此操作: http://labix.org/ python-dateutil

here is a recurrence widget for jquery, which parses/creates RFC5545 compatible recurrence strings.

https://github.com/collective/jquery.recurrenceinput.js

it does not expanding of a recurrence rule into occurrence dates, though. but it includes a python server, which can do it for you, using python-dateutil: http://labix.org/python-dateutil

苍暮颜 2024-12-22 06:37:40

我自己需要这个功能以及时区支持,所以我制作了一个 typescript/javascript 库: rSchedule

目前支持除 BYSETPOS、BYWEEKNO 和 BYYEARDAY 之外的所有 ICAL 重复规则。支持与 ICAL 格式之间的序列化以及大量额外的内容。

例子:

const rule = new RRule({
  frequency: 'YEARLY',
  byMonthOfYear: [2, 6],
  byDayOfWeek: ['SU', ['MO', 3]],
  start: new Date(2010,1,7),
}, {
  dateAdapter: StandardDateAdapter
})

let index = 0;
for (const date of rule.occurrences()) {
  date.toISOString()
  index++

  if (index > 10) break;
}

rule.occurrences({
  start: new Date(2010,5,7),
  take: 5
})
  .toArray()
  .map(date => date.toISOString())

I needed this functionality myself, along with time zone support, so I made a typescript/javascript library: rSchedule.

Currently supports all ICAL recurrence rules except BYSETPOS, BYWEEKNO, and BYYEARDAY. Supports serialization to/from ICAL format along with a ton of extra stuff.

Example:

const rule = new RRule({
  frequency: 'YEARLY',
  byMonthOfYear: [2, 6],
  byDayOfWeek: ['SU', ['MO', 3]],
  start: new Date(2010,1,7),
}, {
  dateAdapter: StandardDateAdapter
})

let index = 0;
for (const date of rule.occurrences()) {
  date.toISOString()
  index++

  if (index > 10) break;
}

rule.occurrences({
  start: new Date(2010,5,7),
  take: 5
})
  .toArray()
  .map(date => date.toISOString())
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文