Basic node-cron usage
import cron from 'node-cron';
// Every weekday at 09:00 New York time
cron.schedule(
'0 9 * * 1-5',
() => {
console.log('Tick');
},
{ timezone: 'America/New_York' }
);node-cron is the most-installed cron library on npm — a light wrapper that schedules JavaScript callbacks on cron-style expressions. It supports 5- and 6-field cron syntax, IANA timezones, and start/stop control. It does not support the L / W / # modifiers — for those, use a Quartz-flavoured library or a runtime check.new Date().getDate() vs the last day of the month — same pattern as the robfig/cron approach.View future cron matches in a calendar
Showing next 1000 cron schedules
import cron from 'node-cron';
// Every weekday at 09:00 New York time
cron.schedule(
'0 9 * * 1-5',
() => {
console.log('Tick');
},
{ timezone: 'America/New_York' }
);// Every 30 seconds (6-field with seconds at the front)
cron.schedule('*/30 * * * * *', () => {
console.log('Half-minute tick');
});The 6-field syntax with seconds works in node-cron, but not in standard 5-field cron. Pin to 5-field if you need to port the schedule to other systems.
const task = cron.schedule('*/5 * * * *', () => {
pollExternalApi();
});
// Pause during a maintenance window
task.stop();
// Resume after maintenance
task.start();
// Tear down completely
task.destroy();if (!cron.validate(userProvidedExpression)) {
throw new Error(`Invalid cron expression: ${userProvidedExpression}`);
}
cron.schedule(userProvidedExpression, runUserJob);Use cron.validate when accepting cron expressions from users — invalid input causes node-cron to throw at scheduling time, which is harder to handle than a proactive validation step.
maxConcurrency options from a queue library.node-cron accepts 5- or 6-field cron expressions. The 6-field form adds an optional seconds field at the front. Standard wildcards (`*`, `,`, `-`, `/`) are supported. `L`, `W`, `?`, `#` are NOT supported.
Pass `{ timezone: 'America/New_York' }` (or any IANA timezone) as the third argument to `cron.schedule`. Without it, node-cron uses the Node.js process timezone (typically the host's local time).
`cron.schedule` returns a `ScheduledTask` object with `.stop()` and `.start()` methods. You can also pass `{ scheduled: false }` to create a task that doesn't start firing immediately.
`node-cron` is light, simple, no extra modifiers. `cron` (older package) supports a Quartz-like 6-field form with seconds at the front. `croner` is modern, lightweight, supports `L`. `cron-parser` is parsing-only (no scheduling). Pick based on the cron features you need.
Ready to schedule it?
WordPress, Shopify, Railway, Cloud Run, Vercel, HubSpot, Ghost, your own box. If it answers HTTP, Crontap can drive it on a clock you can read, in the timezone that actually matters, and page you when something breaks.
Free forever tier ・ No credit card required
Schedule
“every 5 minutes”
Next run
in 23s