cron.js
Weekly Cron expressions parser and generator
Setup
Browser:
<script src="cron.min.js"></script>
Node:
npm i cron.js --save
import Cron from 'cron.js'
or
var Cron = require('cron.js')
Usage
Days map reference:
1: 'SUN'
2: 'MON'
3: 'TUE'
4: 'WED'
5: 'THU'
6: 'FRI'
7: 'SAT'
Examples:
let data = {
days: [1, 2, 3, 4, 5, 6],
startTime: '18:30:00'
};
new Cron( data, { shorten: true } ).expression;
new Cron( data, { numeric: false } ).expression;
new Cron( { days: ['FRI', 'SAT'] } ).expression;
Cron.make( data, { numeric: false, shorten: true } );
Cron.parse('* 30 18 * * 1-3');
Cron.parse('* 30 18 * * 1,3,6');
Cron.parse('* * 12 * * SUN-SAT');
Default options
{
numeric: true,
optimize: false
}
Development - Contribute!
Source code inside src
folder, written in ES6, that gets loaded by babel and transpiled to ES5.
Build and minified versions in dist
folder.
Tests can be found in test
folder.
npm i // Installs npm dependencies
npm start // Compiles and minifies source code
npm test // Runs test suite