fix: correct busy slot title for ics feed integration troubleshoot (#23929)

* fix: correct busy slot title for ics feed integration troubleshoot

* Prevent 'as' call by wrapping getFirstPropertyValue in string

---------

Co-authored-by: Kartik Saini <41051387+kart1ka@users.noreply.github.com>
Co-authored-by: Pallav <90088723+Pallava-Joshi@users.noreply.github.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
This commit is contained in:
Bandhan Majumder
2025-12-04 05:49:34 +00:00
committed by GitHub
co-authored by Kartik Saini Pallav Alex van Andel
parent a11f7e6510
commit 741144bff2
@@ -24,7 +24,7 @@ const getTravelDurationInSeconds = (vevent: ICAL.Component) => {
// integer validation as we can never be sure with ical.js
if (!Number.isInteger(travelSeconds)) return 0;
return travelSeconds;
} catch (e) {
} catch {
return 0;
}
};
@@ -146,7 +146,7 @@ export default class ICSFeedCalendarService implements Calendar {
const userId = this.getUserId(selectedCalendars);
// we use the userId from selectedCalendars to fetch the user's timeZone from the database primarily for all-day events without any timezone information
const userTimeZone = userId ? await this.getUserTimezoneFromDB(userId) : "Europe/London";
const events: { start: string; end: string }[] = [];
const events: { start: string; end: string; title: string }[] = [];
calendars.forEach(({ vcalendar }) => {
const vevents = vcalendar.getAllSubcomponents("vevent");
@@ -159,7 +159,9 @@ export default class ICSFeedCalendarService implements Calendar {
// if (vevent?.getFirstPropertyValue("transp") === "TRANSPARENT") return;
const event = new ICAL.Event(vevent);
const title = String(vevent.getFirstPropertyValue("summary"));
const dtstartProperty = vevent.getFirstProperty("dtstart");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const tzidFromDtstart = dtstartProperty ? (dtstartProperty as any).jCal[1].tzid : undefined;
const dtstart: { [key: string]: string } | undefined = vevent?.getFirstPropertyValue("dtstart");
@@ -263,6 +265,7 @@ export default class ICSFeedCalendarService implements Calendar {
events.push({
start: currentStart.toISOString(),
end: dayjs(currentEvent.endDate.toJSDate()).toISOString(),
title,
});
}
}
@@ -283,6 +286,7 @@ export default class ICSFeedCalendarService implements Calendar {
return events.push({
start: finalStartISO,
end: finalEndISO,
title,
});
});
});