ical-expander icon indicating copy to clipboard operation
ical-expander copied to clipboard

Having problems with an EXDate

Open rutledgek opened this issue 4 years ago • 9 comments

I have the following calendar Content. When I run the icalExpander.between() I get an error of invalid date-time value: "2020-11-26T::"

The calendar content seems to be building the EXDate with a a comma-separated list of dates without times. Does the expander expect dates and times there? The Icalendar Format.org definition seems to allow for date-time or date.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ddaysoftware.com//NONSGML DDay.iCal 1.0//EN
BEGIN:VEVENT
DTEND:20201110T110000
DTSTAMP:20201102T160712Z
DTSTART:20201110T080000
EXDATE:20201126,20201127
RRULE:FREQ=WEEKLY;BYDAY=MO,TH
SEQUENCE:0
UID:652ea16f-d20f-472b-b906-191e5339cf55
END:VEVENT
END:VCALENDAR

rutledgek avatar Nov 02 '20 16:11 rutledgek

Where did you get this entry from?

mifi avatar Nov 03 '20 11:11 mifi

Correct me if I'm wrong, but I think the problem here is that you have two comma separated dates in exdate. It doesn't look like ical.js supports this. I have created an issue here: https://github.com/mozilla-comm/ical.js/issues/458

mifi avatar Nov 03 '20 12:11 mifi

Thanks. It is generated by our c# backend and does work for calendar software. I got the same error with a single item that was a single date without a time.

rutledgek avatar Nov 03 '20 13:11 rutledgek

EXDATE can have a list of values

https://tools.ietf.org/html/rfc5545#section-3.8.5.1

I would recommend you to use RecurExpansion from the Mozilla ICAL API, which should handle those cases.

radarfox avatar Nov 03 '20 14:11 radarfox

@radarfox ical.js seems to already support multiple values (see https://github.com/mozilla-comm/ical.js/issues/458). The problem seems to be that it doesn't support this short date format without a time. e.g. EXDATE:20201126 also crashes.

mifi avatar Nov 03 '20 14:11 mifi

I believe that iCal does indeed use 'T'. See for example this file: https://github.com/mifi/ical-expander/blob/4c3b6e7479d81bd92f67fb46387859b58b6b0a45/test/icaljs-issue-257.ics#L12

mifi avatar Nov 03 '20 14:11 mifi

Yes, I figured that out, I was confused by the format in the error message. Looks like you are right and the problem is in the date-only format.

radarfox avatar Nov 03 '20 14:11 radarfox

Anyway, I have spend a lot of time working with this library lately and I ended up refactoring it to a simple method which uses RecurExpansion and the parametrs of IcalExpander (after, before). It covers basicaly all the functionality of this library. I guess this class wasn't available in the API back then. So I would recommend you doing the same, instead of having to fix bugs like these.

radarfox avatar Nov 03 '20 14:11 radarfox

Cool! could you provide an example?

mifi avatar Nov 06 '20 23:11 mifi