Description
n8n-nodes-cron-parser


Parse cron expressions and calculate next/previous run times with timezone support for n8n workflows.
Features
- ⏰ Next Run Time – Calculate when a cron job will run next
- 📅 Multiple Run Times – Get multiple upcoming execution times
- ⏮️ Previous Run Time – Calculate when a cron job last ran
- ✅ Validation – Validate cron expressions before use
- 🌍 Timezone Support – Full IANA timezone database support
- 📊 Multiple Output Formats – ISO strings, timestamps, or formatted dates
- 🔧 Flexible Input – Use expressions to pull data from previous nodes
Installation
Community Nodes Installation
1. Go to Settings > Community Nodes in your n8n instance
2. Select Install
3. Enter n8n-nodes-cron-parser in the search field
4. Click Install
Manual Installation
For self-hosted n8n instances:
npm install n8n-nodes-cron-parser
Then restart your n8n instance.
Usage
Get Next Run Time
Calculate when a cron job will execute next:
Input:
0 0 * (daily at midnight)2024-01-15T10:30:00.000ZUTCOutput:
{
"nextruntime": "2024-01-16T00:00:00.000Z",
"cron_expression": "0 0 *",
"timezone": "UTC",
"currentdatetime": "2024-01-15T10:30:00.000Z"
}
Using with Previous Node Data
You can reference data from previous nodes using n8n expressions:
Cron Expression: {{ $json.cron_expression }}
Current Date/Time: {{ $json.currentdatetime }}
Timezone: {{ $json.timezone }}
Example workflow:
// Previous node output
{
"cron_expression": "0 0 *",
"currentdatetime": "2024-01-15T10:30:00.000Z",
"timezone": "America/New_York"
}// Cron Parser node will calculate next run time
Get Multiple Next Run Times
Calculate multiple upcoming execution times:
Settings:
0 (every hour)52024-01-15T10:30:00.000ZOutput:
{
"nextruntimes": [
"2024-01-15T11:00:00.000Z",
"2024-01-15T12:00:00.000Z",
"2024-01-15T13:00:00.000Z",
"2024-01-15T14:00:00.000Z",
"2024-01-15T15:00:00.000Z"
],
"count": 5,
"cron_expression": "0 ",
"timezone": "UTC"
}
Get Previous Run Time
Calculate when a cron job last executed:
Input:
0 0 *2024-01-15T10:30:00.000ZOutput:
{
"previousruntime": "2024-01-15T00:00:00.000Z",
"cron_expression": "0 0 *",
"timezone": "UTC"
}
Validate Cron Expression
Check if a cron expression is valid:
Input:
0 0 *Output:
{
"isValid": true,
"cronExpression": "0 0 *"
}
For invalid expression:
{
"isValid": false,
"cronExpression": "invalid cron",
"error": "Invalid cron expression"
}
Cron Expression Format
This node uses standard 5-field cron format:
┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
│ │ │ │ │
*
Common Examples
| Expression | Description |
|————|————-|
| * | Every minute |
| 0 | Every hour |
| 0 0 * | Every day at midnight |
| 0 0 0 | Every Sunday at midnight |
| 0 0 1 | First day of every month |
| /5 * | Every 5 minutes |
| 0 9-17 1-5 | Every hour from 9am-5pm on weekdays |
| 0 0 1 1 * | January 1st at midnight (yearly) |
Timezone Support
The node supports all IANA timezone names:
runtime": "2024-01-15T10:30:00.000Z"
}
Include additional information about the calculation (enabled by default): When enabled, the node will continue processing other items even if one fails, outputting error information instead of stopping the workflow. Calculate when the next maintenance window occurs and send reminders. Check if scheduled jobs are running on time by comparing actual run times with expected cron schedules. Calculate multiple upcoming report generation times for scheduling purposes. Calculate job execution times across different timezones for global operations. Validate and test cron expressions before deploying them to production systems. The node provides detailed error messages: Enable “Continue on Error” option to handle errors gracefully and continue processing. MIT Roney DsilvaUnix Timestamp
{
"nextruntime": 1705318200000
}
Formatted String
{
"nextruntime": "Mon, 15 Jan 2024 10:30:00 GMT"
}
Options
Include Details
Continue on Error
Use Cases
1. Schedule Notifications
2. Job Monitoring
3. Report Generation
4. Multi-timezone Operations
5. Cron Expression Testing
Example Workflow
[Get Scheduled Jobs]
→ [Cron Parser - Get Next Run Time]
→ [Compare with Current Time]
→ [Send Alert if Overdue]
Error Handling
Development
Build
npm install
npm run build
Test
npm test
npm run test:coverage
Lint
npm run lint
npm run lint:fix
Dependencies
License
Support
Author
Related Packages