croninja
v1.0.3
Published
A lightweight cron time parser
Downloads
4
Readme
Introduction
A lightweight cron time parser
Code Samples
INPUT
const { Croninja } = require("croninja")
const cron = Croninja({
second: 10,
minute: 2,
hour: 1,
day: 0,
month: 0,
});
If current time is for e.g 2023 July 23 SUN 13:43:20, cronjob will run after 1 hour 2 minutes and 10 seconds (at 2023 July 23 SUN 14:45:40)
OUTPUT
40 45 14 23 7 *
List of parameters
| Parameters | Type |Description |
| ------------- | ------------- | ------------- |
| offsets
| object | required (fields in object: second, minute, hour, day and month) |
| dayOfWeek
| string | optional (value must be mon, tue, wed, thu, fri, sat or sun) |
Installation
NPM:
npm install croninja
Yarn:
yarn add croninja