cron-parser

Parse, validate, and iterate cron expressions in Node.js with full timezone and DST support.

Library
npm
v5.10.2
1,501 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
85 /100 Excellent
Development Activity 92
Maintenance 96
Community 64
Maturity 60
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
85 /100 Excellent
Architecture 85
Code Quality 88
Innovation 84
Learning Curve 82

cron-parser is a mature, dependency-light TypeScript library for parsing and manipulating cron expressions in Node.js. It turns a crontab string into an iterable interval you can step forward and backward through to compute the next and previous scheduled run times, with correct handling of timezones and daylight-saving transitions via Luxon.

Beyond basic five-field crontab syntax, it supports optional seconds, predefined shortcuts like @daily and @weekly, special characters (L for last day, # for nth weekday, H for hash-randomized values), strict validation mode, and reading entire crontab files. It is the parsing engine underneath many popular Node.js job-scheduling tools.

What You Get

  • A CronExpressionParser that parses standard and 6-field (with seconds) crontab strings into an iterable interval
  • next() / prev() / take() iteration plus for…of support for computing scheduled run times in either direction
  • Timezone and daylight-saving-aware date calculation backed by Luxon, configurable per expression
  • Support for predefined aliases (@daily, @weekly, @hourly), and special characters L, #, and H
  • A CronFileParser for reading crontab files (async and sync), returning variables, expressions, and errors
  • Strict validation mode and first-class TypeScript types throughout

Common Use Cases

  • Computing the next run time of a scheduled job from a user-supplied cron string
  • Validating cron expressions entered in an admin UI or configuration file before saving
  • Powering job schedulers, task queues, and reminder systems that accept cron syntax
  • Displaying a human-facing list of upcoming run times for a recurring task

Under The Hood

Architecture - Parsing flows through src/CronExpressionParser.ts, which normalizes predefined aliases and splits a raw string into fields, each modeled by a dedicated class in src/fields/ (CronSecond, CronMinute, CronHour, CronDayOfMonth, CronMonth, CronDayOfWeek) extending the abstract CronField base. Parsed fields are held in a CronFieldCollection, and a CronExpression wraps that collection to expose the iterator (next/prev/take), computing candidate dates with an internal CronDate and validating them against optional start/end bounds; CronFileParser layers crontab-file reading on top of the same engine.

Tech Stack - Written in TypeScript (targeting Node.js >= 18) with a single runtime dependency, Luxon, used for timezone-aware and DST-correct date arithmetic. The build compiles to CommonJS via tsc with emitted type declarations; tooling includes Jest for tests, ESLint and Prettier for style, tsd for type tests, Husky/lint-staged for pre-commit hooks, and typedoc for API docs.

Code Quality - The codebase is cleanly decomposed with one class per cron field, private class fields for encapsulation, and thorough JSDoc. It ships an extensive Jest suite in tests/ covering the parser, each field, dates, the file parser, and the random/hash helper, with coverage badges generated in CI, plus dedicated type tests via tsd. Naming is consistent and the public surface is fully typed.

API Design - The entry point is a single CronExpressionParser.parse(expression, options) call returning an iterable interval, which keeps first use minimal while options (currentDate, startDate, endDate, tz, strict, hashSeed) cover advanced needs. Iteration reads naturally through next(), prev(), take(n), and for...of, errors surface as thrown exceptions with clear messages, and the README documents field values, special characters, and edge cases in depth.

Used by 34 apps in this directory

TypeScript
93%
Apache 2.0

InsForge

Databases · Developer Tools

13,176

The all-in-one, open-source backend platform purpose-built for AI coding agents — giving your agent database, auth, storage, edge functions, a model gateway, and compute to ship full-stack apps end-to-end.

View details
86
Repo Health
81
Technical
72
Dependency
Built with
TypeScript 93%
Updated 6 days ago
TypeScript
66%
MIT

Jitsu

Data Engineering

5,110

Open-source, fully-scriptable data ingestion engine that streams events from web, apps, and APIs to any data warehouse in real time.

View details
89
Repo Health
79
Technical
66
Dependency
Built with
TypeScript 66%
Go 32%
Updated 1 weeks ago
TypeScript
87%
MIT

medusa

Ecommerce

36,897

The most flexible open-source commerce platform — build B2C, B2B, and marketplace applications with modular, composable commerce primitives.

View details
94
Repo Health
87
Technical
63
Dependency
Built with
TypeScript 87%
JavaScript 12%
Updated 1 weeks ago
TypeScript
92%
Other

n8n

Automation · No Code Platforms

208,437

Code when you need it, UI when you don't — the workflow automation platform built for technical teams who refuse to choose.

View details
95
Repo Health
87
Technical
62
Dependency
Built with
TypeScript 92%
Updated 1 weeks ago
TypeScript
84%
Apache 2.0

nao

AI Development · Analytics

1,949

Build and deploy an open-source analytics agent that understands your data warehouse and answers business questions in plain English.

View details
85
Repo Health
76
Technical
67
Dependency
Built with
TypeScript 84%
Python 15%
Updated 6 days ago
TypeScript
99%
Other

NocoBase

Low Code Platforms · No Code Platforms

24,686

Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
TypeScript 99%
Updated 6 days ago
TypeScript
65%
Other

NocoDB

Databases · Low Code Platforms · No Code Platforms

65,340

Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.

View details
91
Repo Health
77
Technical
63
Dependency
Built with
TypeScript 65%
Vue 30%
Updated 6 days ago
TypeScript
98%
Other

Novu

Developer Tools

40,195

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated 6 days ago
TypeScript
96%
Apache 2.0

OneUptime

Monitoring

7,751

The complete open-source observability platform that replaces PagerDuty, Datadog, Sentry, and StatusPage with a single self-hostable system.

View details
91
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 96%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers