check if the event is date-based or time-based
This commit is contained in:
parent
67bdba2ee6
commit
ba597a2556
13
server.js
13
server.js
|
@ -75,12 +75,23 @@ app.post('/merge', async (req, res) => {
|
|||
const end = new Date(event.end);
|
||||
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
|
||||
if (event.start.includes('T')) {
|
||||
// Time-based event
|
||||
calendar.createEvent({
|
||||
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