Closed patril closed 5 years ago
I think it's probably better to range check the year value and adjust it if it's out of bounds. If the event is not wanted, it can be removed by the caller. With a date so low or high it likely won't show up on the calendar anyway unless the recurrence actually generates dates in the range you're looking at.
We encountered an issue where Google calendar ICS data contained an event on 12/30/0000. We have no idea how this happened on Google's end, but it might have something to do with the fact that the event is recurring. We tried viewing the calendar several ways, but none of the ICS clients allows us to view that date to see the event. However, it always appears in the data, causing the parsing of the entire calendar to fail. Specifically, in
EWSoftware.PDI.DateUtils.FromISO8601String(string, bool)
.convertedDate
is set tonew DateTime(year, month, day)
.We'd like to propose skipping the event altogether if year/month/day would exceed DateTime.MinValue or DateTime.MaxValue. The event would not be available in the parsed calendar, but the alternative is the current exception that causes the entire calendar to fail. We would assume that any date outside the range of System.DateTime is bad data.
The specific VEVENT property that has a bad value is RECURRENCE-ID:
RECURRENCE-ID:00001230T040000Z
As a workaround, we're replacing all occurrences of
RECURRENCE-ID:0000
withRECURRENCE-ID:1900
prior to callingEWSoftware.PDI.Parser.VCalendarParser.ParseFromString(string)
.