689 B
689 B
// create-event.js
// npm install ics
const { createEvent } = require(\"ics\");
const fs = require(\"fs\");
const event = {
title: \"Birthday Party\",
start: [2024, 7, 20], // YYYY, M, D
duration: { hours: 2 },
attendees: [
{ name: \"Alice\" },
{ name: \"Bob\" }
]
};
createEvent(event, (error, value) => {
if (error) {
console.error(\"Error creating event:\", error);
return;
}
fs.writeFileSync(\"birthday-party.ics\", value);
console.log(\"Calendar event created: birthday-party.ics\");
});
Run it with:
npm install ics
node create-event.js
This will generate a birthday-party.ics file you can import into a calendar app.