1
0
Fork 0

check if calendar is date based or event based in calendar/:name endpoint

This commit is contained in:
Ryan Mwangi 2024-11-04 15:24:33 +03:00
parent c264c6b842
commit a752485d5e
1 changed files with 15 additions and 0 deletions

View File

@ -184,6 +184,21 @@ app.get('/calendar/:name', async (req, res) => {
const start = vevent.startDate.toJSDate();
const end = vevent.endDate.toJSDate();
const summary = result.override ? result.prefix : `${result.prefix} ${vevent.summary}`;
if (vevent.startDate.isDate) {
calendar.createEvent({
start: start.toISOString().split('T')[0],
end: end.toISOString().split('T')[0],
summary: summary,
allDay: true,
});
} else {
calendar.createEvent({
start: start,
end: end,
summary: summary,
});
}
});
const parsedCalendar = ical.parseICS(result.data);