Cron expression explainer
Parses strict 5-field Vixie cron (minute hour day-of-month month day-of-week), expands each field and lists up to 20 upcoming UTC matches from a start instant. Out-of-range values, wrong field counts, macros and bad steps give explicit results; no real scheduled job is ever registered.
Inputs and parameters
input— Cron expression (strict 5 fields)from— Start (optional, zone-aware ISO; empty = now)count— Match count (1–20)
Real example
input=*/15 0-4 1,15 * 1-5, from=2023-11-14T22:13:20Z, count=3
→ minute=[0,15,30,45], hour=[0,1,2,3,4]; next 3: 2023-11-15T00:00:00.000Z / 00:15 / 00:30 (UTC). Input 60 * * * * raises INVALID_CRON; @daily raises INVALID_CRON; 4 or 6 fields raise CRON_FIELDS.
Limits and failure handling
Strict 5-field Vixie semantics in UTC: no seconds/year fields, @macros, L/W/#, randomized H or timezone-aware scheduling. When both day fields are restricted they match with OR. Only up to 366 days / 20 matches are computed; legal-but-impossible combinations (e.g. 30 FEB) explicitly return no matches. Input cap 2 KiB.
FAQ
Will it actually schedule a job?
No. Pure parsing plus a bounded 366-day scan; the source has no setTimeout / setInterval / Worker / crontab invocation and no scheduling API.
Are seconds fields or @daily supported?
No — to avoid mixing Quartz and other scheduler dialects, only 5 fields are accepted. In day-of-week, 0 and 7 both mean Sunday; JAN–DEC and SUN–SAT three-letter names are supported.