jens-maus / node-ical

NodeJS class for parsing iCalendar/ICS files
Apache License 2.0
118 stars 50 forks source link

Public school calendar throwing exception for what looks like a time zone issue #305

Closed sujal closed 6 months ago

sujal commented 6 months ago

This ical URL is failing with node-ical v0.17.1: https://www.washougal.k12.wa.us/hathaway/calendars/category/school-events/?post_type=tribe_events&ical=1&eventDisplay=list

TypeError: (name || "").toLowerCase is not a function
    at normalizeName (/usr/app/node_modules/moment-timezone/moment-timezone.js:404:23)
    at Function.getZone [as zone] (/usr/app/node_modules/moment-timezone/moment-timezone.js:426:10)
    at Object.DTSTAMP (/usr/app/node_modules/node-ical/ical.js:301:42)
    at Object.handleObject (/usr/app/node_modules/node-ical/ical.js:665:39)
    at Object.parseLines (/usr/app/node_modules/node-ical/ical.js:717:18)
    at Object.parseICS (/usr/app/node_modules/node-ical/ical.js:750:12)
    at /usr/app/node_modules/node-ical/node-ical.js:112:14
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

There's only 1 VTIMEZONE block in the file, see below:

BEGIN:VTIMEZONE
TZID:Africa/Abidjan
BEGIN:STANDARD
TZOFFSETFROM:+0000
TZOFFSETTO:+0000
TZNAME:GMT
DTSTART:20240101T000000
END:STANDARD
TZID:America/Los_Angeles
BEGIN:DAYLIGHT
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
TZNAME:PDT
DTSTART:20240310T100000
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
TZNAME:PST
DTSTART:20241103T090000
END:STANDARD
END:VTIMEZONE

icalendar.org's validator says this is a valid ical feed: https://icalendar.org/validator.html?url=https://www.washougal.k12.wa.us/hathaway/calendars/category/school-events/?post_type=tribe_events&ical=1&eventDisplay=list

I'm going to setup to debug the library soon, will update the ticket soon. If there are specific things you need me to share re: configs/etc, please let me know.

sujal commented 6 months ago

I've submitted a patch/workaround in PR#307 https://github.com/jens-maus/node-ical/pull/307