cron-parser

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

Library
npm
v5.10.1
1,495 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
84 /100 Excellent
Development Activity 88
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
72%
AGPL 3.0

APITable

Databases · Low Code Platforms

15,623

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
71
Repo Health
77
Technical
60
Dependency
Built with
TypeScript 72%
Java 22%
Updated 3 weeks ago
Go
85%
Apache 2.0

Argo Workflows

Data Engineering · Devops

17,006

The most popular Kubernetes-native workflow engine for orchestrating containerized DAGs, ML pipelines, CI/CD, and parallel batch jobs at scale.

View details
96
Repo Health
90
Technical
68
Dependency
Built with
Go 85%
TypeScript 11%
Updated 4 days ago
Go
75%
AGPL 3.0

Coder

Code Editors · Developer Tools · Devops

16,729

Self-hosted cloud development environments and AI coding agents — defined in Terraform, connected via WireGuard, automatically shut down when idle.

View details
91
Repo Health
90
Technical
65
Dependency
Built with
Go 75%
TypeScript 23%
Updated 4 days ago
TypeScript
88%
MIT

DevTools-X

Developer Tools

1,534

41 offline-first developer utilities in a single 10MB cross-platform desktop app — no Electron, no cloud, no compromise.

View details
49
Repo Health
68
Technical
68
Dependency
Built with
TypeScript 88%
Updated 4 months ago
TypeScript
50%
Other

Dify

AI Development · Design Tools · Developer Tools

157,364

Visual LLM workflow platform with RAG pipelines, agent capabilities, and model management for building production AI applications.

View details
92
Repo Health
85
Technical
66
Dependency
Built with
TypeScript 50%
Python 47%
Updated 4 days ago
TypeScript
92%
AGPL 3.0

Documenso

Digital Signiture

15,224

Self-hosted, open-source DocuSign alternative with legally binding PDF signatures, multi-party workflows, and a full REST and tRPC API.

View details
93
Repo Health
79
Technical
68
Dependency
Built with
TypeScript 92%
Updated 4 days ago
TypeScript
90%
Other

FastGPT

AI Agents · AI Development

29,758

Build, debug, and deploy knowledge-based AI agents with a visual workflow editor, RAG retrieval, and support for any OpenAI-compatible LLM.

View details
93
Repo Health
84
Technical
66
Dependency
Built with
TypeScript 90%
Updated 4 days ago
TypeScript
97%
Other

GrowthBook

Ab Testing Experimentation · Analytics · Developer Tools

8,446

Open source feature flags, A/B testing, and warehouse-native experimentation that queries your existing data infrastructure—no data movement required.

View details
92
Repo Health
85
Technical
63
Dependency
Built with
TypeScript 97%
Updated 4 days ago
TypeScript
97%
Other

Infisical

Devops · Security

29,468

The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.

View details
91
Repo Health
84
Technical
65
Dependency
Built with
TypeScript 97%
Updated 4 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