Event cron - a module for manager your events using node-cron!
NPM
npm install eventcron
YARN
yarn add eventcron
const { EventCron } = require('eventcron');
(async () => {
const eventStarter = new EventCron({events: [{name: "event1", startIn: "02/11/2022:3:05", endIn: "02/11/2022:3:06"}]})
const initEvent = await eventStarter.start()
initEvent.on("eventStarted", console.log)
initEvent.on("eventEnded", console.log)
})
events: [{name: "Name your event", startIn: "date/hour start event (hour opcional)", endIn: "date/hour end event (hour opcional)"}],
pattern: "pattern node cron (Default value: 0 0 * * * (Every midnight))" //ATTENCION! If propriety of event startIn or endIn includes hours change pattern to */1 * * * *
timezone: "Your timezone (Default value: Timezone from Server)"
name: string //Name of event,
index: number //Index of array