datetime-scheduler
ECMAScript 6 (JavaScript) NPM module for executing scheduled tasks
Installation
npm i datetime-scheduler --save
Notice: This module has zero NPM dependencies, but it uses ES6 language.
Usage
This example calls asyncTask method every saturday and sunday at 12:15 (and 30.500 seconds)
const createScheduler = ;const configuration ="days":"sunday": true"monday": false"tuesday": false"wednesday": false"thursday": false"friday": false"saturday": true"time":"hours": 12"minutes":15"seconds": 30"millis": 500;const options =asyncTask: async {console;await ;console;};;
In case you need only one execution on a specific day
const specificDay = "2019-05-18T19:30:00.000Z";const configuration ="timestamp": specificDay;
You also can use a timestamp or an interval as your configuration options. Interval should be stated in minutes.
const configuration ="interval": 40;
Check weekend.js for a working example.
License
MIT License