How to convert an event in string format into DDay.iCal Event?

381 Views Asked by At

I have an event string like so:

BEGIN:VEVENT
CREATED;
VALUE=DATE:00010101 
DTSTAMP:20150527T074655Z 
DTSTART;VALUE=DATE:00010101  
EFFECTIVEDATETIME:2015-05-27T07:46:55.3203522+00:00 
RRULE:FREQ=DAILY;BYHOUR=12;BYMINUTE=0 
SEQUENCE:0 
SUMMARY:BLAH 
UID:0622249b-7161-4e31-9517-f51dddaa4cd8 
END:VEVENT

How do I Deserialize this into DDay.iCal event?

1

There are 1 best solutions below

0
On

You can't deserialize that, because you have invented things that aren't part of the icalendar spec, and aren't supported by ical.net (dday.ical is now ical.net). These things are malformed, or don't exist:

CREATED;
VALUE=DATE:00010101
EFFECTIVEDATETIME:2015-05-27T07:46:55.3203522+00:00

Have a look at the VEVENT documentation for valid VEVENT blocks: http://www.kanzaki.com/docs/ical/vevent.html

Your question speaks to a weakness of the ical.net API: you can't deserialize icalendar components in a piecemeal fashion. In a perfect world, you would be able to pass your string to the Event constructor, and it would do the right thing.

I have an open ticket to re-evaluate ical.net's parsing and serialization which will cover this use case. Getting there will take some time.

https://github.com/rianjs/ical.net/issues/22