cron-runs
v1.0.0
Published
Get next and previous runs for a standard 5-field cron expression as normalized timestamps.
Maintainers
Readme
cron-runs for JavaScript
Get the next and previous runs for a standard 5-field cron expression as normalized timestamps.
Install
npm install cron-runsFeatures
- Standard 5-field cron only
- Timezone-aware output
- Reference time support
- ISO UTC, ISO with timezone offset, Unix seconds, Unix milliseconds
- Human-readable cron description
Usage
import { getCronRuns } from 'cron-runs';
const result = getCronRuns({
cron: '0 9 * * 1-5',
timezone: 'America/Los_Angeles',
reference_time: '2026-04-14T10:30:00-07:00',
next: 2,
prev: 1
});
console.log(result);API
getCronRuns(options)
Inputs
cronstring, requiredtimezonestring, optional, defaultUTCreference_timestring or number, optional, default nownextinteger, optional, default1previnteger, optional, default1
Notes
reference_timeaccepts:- ISO UTC
- ISO with timezone offset
- Unix seconds
- Unix milliseconds
nextandprevcan be0through100- This package does not schedule jobs. It only calculates occurrences.
