jens-maus / node-ical

NodeJS class for parsing iCalendar/ICS files
Apache License 2.0
122 stars 52 forks source link

ICS with exdate not processed #338

Closed sdetweil closed 3 weeks ago

sdetweil commented 1 month ago

we have a testcase for excluded dates in recurrence, with v 19 those are not in the parsed ics output

BEGIN:VEVENT
DTSTART;TZID=Australia/Sydney:20230920T100000
DTEND;TZID=Australia/Sydney:20230920T110000
RRULE:FREQ=WEEKLY;BYDAY=WE
EXDATE;TZID=Australia/Sydney:20230927T100000
EXDATE;TZID=Australia/Sydney:20231004T100000
DTSTAMP:20231025T233434Z
UID:sdflbkasuhdb5fkauglkb@google.com
CREATED:20230306T193128Z
LAST-MODIFIED:20231024T222515Z
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:My Event
TRANSP:OPAQUE
END:VEVENT

parsed output

{"sdflbkasuhdb5fkauglkb@google.com":{"type":"VEVENT","params":[],"start":"2023-09-20T00:00:00.000Z","datetype":"date-time","end":"2023-09-20T01:00:00.000Z","rrule":{"_cache":{"all":false,"before":[],"after":[],"between":[]},"origOptions":{"tzid":"Australia/Sydney","dtstart":"2023-09-20T10:00:00.000Z","freq":2,"byweekday":[{"weekday":2}]},"options":{"freq":2,"dtstart":"2023-09-20T10:00:00.000Z","interval":1,"wkst":0,"count":null,"until":null,"tzid":"Australia/Sydney","bysetpos":null,"bymonth":null,"bymonthday":[],"bynmonthday":[],"byyearday":null,"byweekno":null,"byweekday":[2],"bynweekday":null,"byhour":[10],"byminute":[0],"bysecond":[0],"byeaster":null}},
"exdate":[],    <----- empty
"dtstamp":"2023-10-25T23:34:34.000Z","uid":"sdflbkasuhdb5fkauglkb@google.com","created":"2023-03-06T19:31:28.000Z","lastmodified":"2023-10-24T22:25:15.000Z","sequence":"0","status":"CONFIRMED","summary":"My Event","transparency":"OPAQUE"}} 
sdetweil commented 1 month ago

one thing to note is that our testcase sets the date to "14 Sep 2023 12:30:00 GMT+10:00"

so this event is in the past technically if you useany recent date..

sdetweil commented 1 month ago

this is a false report.. the problem with that output is JSON.stringify() wont return the complex structure in the exdate array..

using console.log("message", exdate) works correctly ..

the REAL problem is the exdate is converted to UTC time.. so the DATE is the next day, and that DATE is used as the key to match events in the between() return.. 11-01 between date will never match 11-02 (utc) exdate

i have fix for this problem.. want to test some more.. cause it affects every date

sdetweil commented 1 month ago

does anyone know how to code a vows testcase that sets a run date and extract the exdate field and checks its contents? exdate is a hash yyyy-mm-dd: full timestsmp

for this testcase there are 2 excluded dates from the rrule return

i want to check the rrule.between return and the exdate