check if the event is date-based or time-based
This commit is contained in:
parent
67bdba2ee6
commit
ba597a2556
23
server.js
23
server.js
|
@ -75,12 +75,23 @@ app.post('/merge', async (req, res) => {
|
||||||
const end = new Date(event.end);
|
const end = new Date(event.end);
|
||||||
const summary = result.override ? result.prefix : `${result.prefix} ${event.summary}`;
|
const summary = result.override ? result.prefix : `${result.prefix} ${event.summary}`;
|
||||||
|
|
||||||
// Add event to the calendar
|
// Check if the event is date-based or time-based
|
||||||
calendar.createEvent({
|
if (event.start.includes('T')) {
|
||||||
start: start,
|
// Time-based event
|
||||||
end: end,
|
calendar.createEvent({
|
||||||
summary: summary,
|
start: start,
|
||||||
});
|
end: end,
|
||||||
|
summary: summary,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Date-based event
|
||||||
|
calendar.createEvent({
|
||||||
|
start: start,
|
||||||
|
end: end,
|
||||||
|
summary: summary,
|
||||||
|
allDay: true, // Mark as an all-day event
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue