Documentation

Install CronCraft, choose the right cron syntax, and see how your schedules behave.

.NET library

Install CronCraft in a .NET 8 project.

dotnet add package CronCraft

Call ToHumanReadable for a description, or use TryToHumanReadable or TryValidate when handling user input.

using CronCraft.Extensions;
using CronCraft.Models;

var settings = new CronSettings { DayNameFormat = "full", TimeFormat = "HH:mm" };
var expression = "0 9 * * MON-FRI";

if (expression.TryToHumanReadable(settings, out var description, out var error))
    Console.WriteLine(description);
else
    Console.Error.WriteLine(error?.Message);

For dependency injection, call services.AddCronCraft(settings => ...) and inject CronCraftService. See the dependency injection examples for configuration and service usage.

Schedule previews

CronSchedule.GetNextOccurrence and GetNextOccurrences evaluate Unix and supported Quartz schedules in the supplied timezone. These APIs are available in the current source. Check the release notes for package availability.

using CronCraft;

var zone = TimeZoneInfo.FindSystemTimeZoneById("Europe/London");
var from = new DateTimeOffset(2026, 3, 27, 9, 0, 0, TimeSpan.Zero);
var runs = CronSchedule.GetNextOccurrences("0 9 * * MON-FRI", from, 5, zone);
// First run: 2026-03-30 09:00 +01:00
  • The starting instant is exclusive. UTC is the default schedule timezone.
  • Results are ordered, unique DateTimeOffset values with their offsets in the schedule timezone.
  • During daylight-saving changes, nonexistent times are skipped and repeated times return both instants.
  • Finite schedules may return fewer runs than requested. A schedule with no remaining run reports no_future_occurrence.

Use named weekdays if you share plain Quartz weekday expressions between description and preview. The preview API notes explain numbering and calendar rules.

English to cron

EnglishCronParser.TryParse converts supported phrases into five-field Unix cron. This API is available in the current .NET source.

using CronCraft;

if (EnglishCronParser.TryParse("weekdays at 18:00", out var cron, out var error))
    Console.WriteLine(cron); // 0 18 * * 1-5
else
    Console.Error.WriteLine(error?.Message);

Try every 15 minutes, daily at 9:30 AM, or every Monday at 9am. See the supported phrase grammar for accepted forms and ambiguity rules.

Command line

Build and install the tool from a checkout with the .NET 8 SDK.

dotnet pack CronCraft.Tool -c Release -o ./artifacts
dotnet tool install --global CronCraft.Tool --add-source ./artifacts --version 0.1.0
CommandPurpose
explainDescribe an expression with optional language, day-name, timezone, and clock settings.
validateCheck whether an expression is supported.
nextList upcoming runs. Use --timezone, --from, and --count to make the preview reproducible.
croncraft explain "0 9 * * MON-FRI" --language fr --day-format full
croncraft validate "*/15 * * * *"
croncraft next "30 2 * * *" --timezone America/New_York \
  --from 2026-03-07T00:00:00Z --count 2 --json

next defaults to five runs after the current instant in UTC. The count can be set from 1 to 100. All three commands accept --json and return schemaVersion: 1.

Exit code 0 indicates success, 1 indicates a validation or schedule error, and 2 indicates invalid command-line usage. Errors go to standard error. See the CLI reference for more examples.

Node.js

The npm package supports Node.js 22 or later with ES modules and TypeScript declarations.

npm install @teesofttech/croncraft
import { tryExplain, validate } from "@teesofttech/croncraft";

const expression = "0 9 * * MON-FRI";
const validation = validate(expression);

if (!validation.valid) {
  console.error(validation.error.code, validation.error.message);
} else {
  const result = tryExplain(expression);
  if (result.ok) console.log(result.description);
  else console.error(result.error.message);
}

The npm API and browser playground support common five-field Unix syntax and English descriptions. Leave at least one of the two day fields as *. The npm README has runnable JavaScript and TypeScript examples and the support matrix.

Cron syntax

Five-field Unix expressions list minute, hour, day of month, month, and day of week, in that order. Use the playground to see a field-by-field breakdown.

ExpressionSchedule
*/15 * * * *Every 15 minutes
0 9 * * MON-FRIAt 09:00 on weekdays
0 9 1,15 * *At 09:00 on the 1st and 15th
0 9 * JAN-MAR *At 09:00 from January through March

Quartz expressions can include seconds and an optional year. The .NET library and CLI support day modifiers such as L, W, and #, and aliases such as @daily. Consult the API syntax and preview notes for day matching and supported ranges.

Feature.NET libraryCLInpm
Explain and validateYesYesFive-field Unix
Quartz and aliasesSupported subsetSupported subset—
Localized descriptionsYesYesEnglish
Timezone-aware previewsCurrent sourceCurrent source—
English to cronCurrent source——

Localization

Set CronSettings.Language when using .NET or --language when explaining an expression from the CLI. The .NET library accepts full, short, single, and custom weekday formats. The CLI accepts the three built-in formats.

See the language list and custom provider guide for localized examples, formatting, and extension points.

Handling errors

Structured validation failures provide a code, message, and the offending field and value when available. Pass the code to your application logic and use the message when showing users what to fix.

croncraft validate "*/61 * * * *" --json

This example reports invalid_field_value for the minute field. See the .NET error-code reference for the other codes.