使用 google-rfc-2445 createDateTimeIterator 生成日期范围时,结束日期 (UNTIL) 被排除

end date(UNTIL) is excluded when using google-rfc-2445 createDateTimeIterator to generate date range

我需要知道如何避免在此创建的日期范围内排除 UNTIL 或结束日期 -

请帮忙。

我正在尝试使用上面给出的答案来获取日期范围 link 但它每次都排除了结束日期。

StartDate = 2020-04-21T00:00:00.000+05:30;
RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20200428

它将 return 我的结果如下:

2020-04-20T18:30:00.000Z
2020-04-21T18:30:00.000Z
2020-04-22T18:30:00.000Z
2020-04-23T18:30:00.000Z
2020-04-24T18:30:00.000Z
2020-04-25T18:30:00.000Z
2020-04-26T18:30:00.000Z
2020-04-27T18:30:00.000Z

您的开始日期和时间似乎是 2020-04-20T18:30:00.000Z 尽管你上面的伪代码。因为这就是您列出的结果:18.30 的复发。

在那些时间每天重复一次,2020-04-28T18:30:00.000Z 将在 2020-04-20T00:00:000Z 之后。

因此请使开始日期或日期时间与结束日期或日期时间一致。来自 https://icalendar.org/iCalendar-RFC-5545/3-3-10-recurrence-rule.html,它说:

The UNTIL rule part defines a DATE or DATE-TIME value that bounds the recurrence rule in an inclusive manner. If the value specified by UNTIL is synchronized with the specified recurrence, this DATE or DATE-TIME becomes the last instance of the recurrence. The value of the UNTIL rule part MUST have the same value type as the "DTSTART" property. Furthermore, if the "DTSTART" property is specified as a date with local time, then the UNTIL rule part MUST also be specified as a date with local time. If the "DTSTART" property is specified as a date with UTC time or a date with local time and time zone reference, then the UNTIL rule part MUST be specified as a date with UTC time.

如果需要 UTC 时间,则将 UNTIL 更改为 2020-04-28T18:30:00.000Z 或者 2020-04-28T18:30:00.000 如果打算浮动时间。
基本上DTSTART和UNTIL必须匹配。