mrkeyoor.com_
Sat 08 Aug 22:00 UTC
npmUtilsupdated 08 Aug 2026

cronstrue

cronstrue turns a cron expression into a sentence for display to a person, such as converting */5 * * * * to “Every 5 minutes.” It understands ordinary five-field cron, expressions with seconds or years, Quartz characters such as ?, L, W, and #, and nicknames such as @monthly. The package has no dependencies, includes TypeScript declarations and a command-line entry point, and can describe schedules in more than thirty languages. It explains an expression; it does not schedule jobs, compute run dates, or fully validate whether a target cron engine will accept the expression.

Verdict

Excellent at the narrow presentation job it claims, with unusually broad cron syntax and localization. Pair it with the parser or scheduler that actually owns validation and timing, and never treat a plausible English sentence as proof that a job will run as intended.

API stability5/5The public programming surface remains centered on one toString(expression, options) call, with additive options for verbosity, clocks, indexing, locale, error behavior, and day-field wording. It accepts the same five-, six-, and seven-field families and nicknames across the current major. The small API and dependency-free distribution reduce compatibility pressure, while explicit options make dialect differences visible instead of silently changing defaults.
Docs5/5The README shows CommonJS, ESM, TypeScript, browser, CDN, and CLI usage; enumerates every option and its default; documents individual versus all-locale loading; lists supported locale codes; and includes a live demo. Its FAQ is especially useful because it clearly says the library does not fully validate expressions or calculate next runs, then gives current examples using cron-parser and croner for those jobs.
Maintenance5/5Version 3.24.0 was published on June 29, 2026, and GitHub reports a push on August 5, 2026. The repository has only four open issues and PRs, carries a current GitHub Actions build badge, and continues maintaining a large translation set without adding runtime dependencies. Recent release activity plus the low queue indicate active stewardship rather than a merely stable old package.
Ecosystem4/5cronstrue recorded 3,403,441 downloads from July 31 through August 6, 2026 and has 1,632 GitHub stars. It supports CommonJS, ESM-style imports, TypeScript declarations, UMD browser use, a CLI, Quartz expressions, and more than thirty locales. Ports of the same cron-expression-descriptor idea exist in several languages. Its ecosystem score stops short of five because it intentionally delegates validation, occurrence calculation, timezones, and execution to other packages.

Use it if

  • You show stored cron expressions in an admin screen, review page, or confirmation dialog
  • You accept Quartz or five-, six-, and seven-field cron syntax and need one display formatter for them
  • Your product needs localized schedule descriptions and can import only the locales it actually ships
  • You want a zero-dependency formatter that works in Node, TypeScript, bundlers, a browser global, and a CLI
Skip it if

Setup reality

npm install cronstrue is the whole install: version 3.24.0 has no dependencies and includes declarations at dist/cronstrue.d.ts. CommonJS uses require('cronstrue'), while TypeScript and bundlers use the documented default import. English is the only locale registered by the base module. For another language, import cronstrue/locales/fr or its equivalent for a side effect before calling toString with locale: 'fr'; importing cronstrue/i18n loads every translation and the README warns that this is much larger in the browser. Pin a version if serving the UMD build from a CDN because the README notes that @latest redirects and can change underneath you. The important setup is semantic, not mechanical. Decide whether a six-field string means seconds and whether the scheduler accepts Quartz characters. Match dayOfWeekStartIndexZero and monthStartIndexZero to the system that will execute the job. Decide whether day-of-month and day-of-week fields use the wording implied by logicalAndDayFields. The default throws on parsing errors, but successful description is not validation; the project's FAQ recommends validating separately with cron-parser. cronstrue also does not know a timezone, compute a Date, or model daylight-saving transitions, so label the scheduler's timezone beside the description. Locale modules translate phrases, but you should still review wording with native speakers and test the exact expressions your product emits. If users enter cron themselves, preserve the original expression, validate with the executor's dialect, and treat the generated sentence as explanatory UI rather than an execution guarantee.

Patterns

Describe a standard five-field expressiondescribe-five-field-cron

import cronstrue from 'cronstrue';

const description = cronstrue.toString('*/5 * * * *');
console.log(description); // Every 5 minutes

The sentence is a description, not full validation. Validate against the cron engine that will execute the expression.

Describe a weekday scheduledescribe-weekdays

const description = cronstrue.toString('0 23 ? * MON-FRI');
console.log(description); // At 11:00 PM, Monday through Friday

The question mark is Quartz syntax for no specific value. Traditional Unix cron implementations may reject it even though cronstrue describes it.

Describe an expression with secondsdescribe-seconds-field

const description = cronstrue.toString('30 */10 * * * *');
console.log(description);

Six fields can include seconds in cronstrue. Confirm that your scheduler uses the same field count because many crontabs accept only five fields.

Describe a cron nicknamedescribe-cron-nickname

cronstrue.toString('@monthly'); // At 12:00 AM, on day 1 of the month

Nicknames are convenient but not universal. The executor, not cronstrue, decides whether @monthly is accepted.

Request a more explicit sentenceuse-verbose-wording

const concise = cronstrue.toString('0 23 * * *');
const verbose = cronstrue.toString('0 23 * * *', { verbose: true });

Verbose mode may add phrases such as every day. Snapshot important product copy because translation wording can evolve.

Format descriptions with a 24-hour clockuse-twenty-four-hour-time

const description = cronstrue.toString('23 14 * * SUN#2', {
  use24HourTimeFormat: true,
});
console.log(description); // At 14:23, on the second Sunday of the month

Some translations already default to 24-hour time. Pass the option explicitly when the product requires a consistent clock style.

Load only the French localeload-one-locale

import cronstrue from 'cronstrue';
import 'cronstrue/locales/fr';

const description = cronstrue.toString('*/5 * * * *', { locale: 'fr' });

Locale imports register translations through side effects. Make sure the import survives tree shaking before calling toString.

Load every bundled translationload-all-locales

import cronstrue from 'cronstrue/i18n';

const french = cronstrue.toString('0 9 * * 1-5', { locale: 'fr' });
const german = cronstrue.toString('0 9 * * 1-5', { locale: 'de' });

The README puts the all-locales file at about 130 KB minified. Prefer individual locale modules in browser bundles.

Turn a parse failure into display textreturn-parse-error

const message = cronstrue.toString(userExpression, {
  throwExceptionOnParseError: false,
});
showPreview(message);

This catches conversion errors and returns the exception message, but it still is not complete cron validation and may expose technical copy to users.

Handle conversion errors explicitlycatch-parse-error

try {
  const description = cronstrue.toString(userExpression);
  showPreview(description);
} catch (error) {
  showFieldError('This schedule cannot be described');
}

throwExceptionOnParseError defaults to true. Keep a separate validator if acceptance by the target scheduler matters.

Interpret weekday one as Mondaymatch-weekday-indexing

const description = cronstrue.toString('* * * ? * 2-6/2', {
  dayOfWeekStartIndexZero: false,
});

The default is true, where weekday numbering starts at zero. Match this setting to the cron dialect that stores and executes the value.

Describe a cron expression from the shelldescribe-from-cli

npx cronstrue "*/15 9-17 * * MON-FRI"

npx may download code when the package is not installed locally. Pin it in the project for repeatable scripts and restricted environments.

Alternatives

PackageRegistryPick it when
cron-parsernpmUse it when validation and actual next or previous occurrence dates matter more than a friendly sentence
cronernpmUse it when the application must calculate runs or execute scheduled callbacks across Node and browser-like runtimes
cron-fastnpmUse it for a small TypeScript parser with timezone-aware date calculations across Node, Deno, Bun, workers, and browsers