bitfireAT/ical4android

Drop RULES with UNTIL before DTSTART

rfc2822 opened this issue · 2 comments

From time to time, events with an RRULE whose UNTIL is before the DTSTART of the event appear, like:

DTSTART: 2022/05/31 13:00
RRULE: … UNTIL 2022/05/31 12:59

Such events are invalid and sometimes cause problems when they're uploaded again to the server (because the server reject them, which is OK).

Thus such RRULEs should be dropped, both when they're received from the server and when they're found in the calendar provider.

This Event was sent by a user:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:DAVx5/3.3.7-ose ical4j/3.0.20 (org.withouthat.acalendarplus)
BEGIN:VEVENT
DTSTAMP:20220530T071034Z
UID:6f367bbe-c3d3-4bdd-ac69-xxxxxxxxxx.1596835176176
SEQUENCE:1
SUMMARY:XXX
DESCRIPTION:XXX
DTSTART;VALUE=DATE:20200912
DTEND;VALUE=DATE:20200913
RRULE:FREQ=YEARLY;UNTIL=20220911T235959Z;BYMONTH=9;BYMONTHDAY=12
CLASS:PUBLIC
STATUS:CONFIRMED
TRANSP:TRANSPARENT
CREATED:20200807T211937Z
END:VEVENT
END:VCALENDAR

https://datatracker.ietf.org/doc/html/rfc5545#page-41 says:

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.

In the above example the first problem is that DTSTART has value type DATE, while UNTIL has value type DATE-TIME.