iCal4j/biweekly 和 google-rfc-2445 有什么区别?

What the difference between iCal4j/biweekly and google-rfc-2445?

现在我正在使用 google-rfc-2445 库来评估重复发生的事件,并生成实际日期,例如了解以下 RRULE 定义的事件何时发生:RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1

我正在使用 biweekly library to generate *.ics files. Actually it does same as iCal4j,但 API 更易于使用。

我看到这两个库在某种程度上具有可互换的功能,所以我的问题是,我可以使用单个库 (iCal4j/biweekly) 来完成这两个任务吗?生成重复事件和 export/import *.ics 文件?

google-rfc-2445 focuses primarily on evaluating recurrence rules, while biweekly and iCal4j 专注于处理整个 iCalendar 文件。

如果您的目标是生成 iCalendar 文件,那么您应该使用 biweekly 或 iCal4j。如果您需要循环访问重复规则中的日期,请使用 google-rfc-2445。如果您只需要 创建 重复规则,则不需要 google-rfc-2445.

biweekly 允许您迭代重复规则中的日期(参见下面的代码)。它使用 google-rfc-2445 来执行此操作。

ICalendar ical = ...
VEvent event = ical.getEvents().get(0);
RecurrenceRule rrule = event.getRecurrenceRule();
Iterator<Date> it = rrule.getDateIterator(event.getDateStart().getValue());