rianjs / ical.net

ical.NET - an open source iCal library for .NET
MIT License
782 stars 230 forks source link

EXDATE has no date value #512

Open M-S-H opened 3 years ago

M-S-H commented 3 years ago

I'm not sure what has led to this problem, but I've encountered serialized calendars that contained a malformed EXDATE without a date value which can be seen in the example below:

PRODID:-//github.com/rianjs/ical.net//NONSGML ical.net 4.0//EN
VERSION:2.0
BEGIN:VEVENT
DTEND;TZID=America/Denver:20210105T163000
DTSTAMP:20210104T162636Z
DTSTART;TZID=America/Denver:20210105T150000
EXDATE;TZID=America/Denver:20210108T150000
EXDATE;TZID=America/Denver:
EXDATE;TZID=America/Denver:20210323T150000
EXDATE;TZID=America/Denver:20210115T150000
RRULE;TZID=UTC:FREQ=WEEKLY;UNTIL=20210514T223000Z;BYDAY=TU,WE,FR
SEQUENCE:0
UID:3b253b48-550a-490d-90cd-8441196ea081
END:VEVENT
BEGIN:VEVENT
DTEND;TZID=America/Denver:20210323T163000
DTSTAMP:20210323T191455Z
DTSTART;TZID=America/Denver:20210323T153000
EXDATE;TZID=America/Denver:20210323T153000
SEQUENCE:0
UID:834764cd-258b-439a-9b02-555e875ba6b8
END:VEVENT
BEGIN:VEVENT
DTEND;TZID=America/Denver:20210323T160000
DTSTAMP:20210323T191517Z
DTSTART;TZID=America/Denver:20210323T153000
SEQUENCE:0
UID:caf565db-1635-4845-ae3e-e0d2308e2dcb
END:VEVENT
END:VCALENDAR

I believe I'm adding exception dates correctly:

var st = new CalDateTime(dateTime, "America/Denver");
var exceptionDateList = new PeriodList();
exceptionDateList.TzId = "America/Denver";
var period = new Period(st);
exceptionDateList.Add(period);
event.ExceptionDates.Add(exceptionDateList);

I could be doing something wrong, but I believe this might be a bug when serializing the calendar.

s3mic0lin commented 3 years ago

I tried to reproduce this behaviour using your code sample, but it was all fine.

I still got some questions: