You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a user-submitted ical feed with a bad timezone:
DTSTART;TZID="(UTC-05:00) Eastern Time (US & C":20240429T170000
First, before we get into what to do about it, that DTSTART is causing my service to crash because of this code (line 151):
// Watch out for offset timezones
// If the conversion above didn't find any matching IANA tz
// And offset is still present
if (tz && tz.startsWith('(')) {
// Extract just the offset
const regex = /[+|-]\d*:\d*/;
tz = null;
found = tz.match(regex);
}
Note that it sets the tz variable to null right before trying to access it. That's just broken, those two operations need to be swapped. (You can see this in a separate block around line 261 that does the same logic)
So, that is a small change, but I don't understand what this code is trying to do. In that case, it's inside getTimeZone which looks like it otherwise is supposed to return an IANA time zone string.
Which brings me to the second item to note: the match call returns an array, not a string. Later code doesn't expect that to be the case, throws errors if I fix the above issue.
I don't know how to map an offset to a IANA timezone without knowing what time zones the user cares about, as I don't know if they are looking for a zone with that offset that supports DST or not. In this case, the rest of the broken TZID string tells me as a human that this should be eastern time in the US, but not sure how to write a general solution for that.
Can someone explain what this block of code was trying to do? I have a fix locally, with a test, but the time is getting set to UTC for that event.
It prevents the crash, though, so we may have to roll with it until we can understand what might be a better fix...
Appreciate any insight, happy to write the code to fix if there's a recommendation.
The text was updated successfully, but these errors were encountered:
I have a user-submitted ical feed with a bad timezone:
First, before we get into what to do about it, that DTSTART is causing my service to crash because of this code (line 151):
Note that it sets the tz variable to null right before trying to access it. That's just broken, those two operations need to be swapped. (You can see this in a separate block around line 261 that does the same logic)
So, that is a small change, but I don't understand what this code is trying to do. In that case, it's inside
getTimeZone
which looks like it otherwise is supposed to return an IANA time zone string.Which brings me to the second item to note: the
match
call returns an array, not a string. Later code doesn't expect that to be the case, throws errors if I fix the above issue.I don't know how to map an offset to a IANA timezone without knowing what time zones the user cares about, as I don't know if they are looking for a zone with that offset that supports DST or not. In this case, the rest of the broken TZID string tells me as a human that this should be eastern time in the US, but not sure how to write a general solution for that.
Can someone explain what this block of code was trying to do? I have a fix locally, with a test, but the time is getting set to UTC for that event.
It prevents the crash, though, so we may have to roll with it until we can understand what might be a better fix...
Appreciate any insight, happy to write the code to fix if there's a recommendation.
The text was updated successfully, but these errors were encountered: