@toolsnap/cron-parser
v1.0.0
Published
Parse cron expressions and calculate next execution times
Maintainers
Readme
@toolsnap/cron-parser
Parse cron expressions and calculate next execution times. Lightweight, zero-dependency.
🔗 Visit risetop.top for more developer tools.
Installation
npm install @toolsnap/cron-parserUsage
const { parse, getNext, describe } = require('@toolsnap/cron-parser');
// Parse a cron expression
const schedule = parse('*/5 * * * *');
// { minutes: [0,5,10,...,55], hours: [0..23], ... }
// Get next 5 execution times
getNext('0 9 * * 1-5', 5).forEach(d => console.log(d));
// Logs: Mon 09:00, Tue 09:00, ...
// Human-readable description
describe('30 8 1,15 * *');
// "Runs at minute 30, at hour 8, on day 1,15"License
MIT
