The cRonstrue.js JavaScript library provides a simple way to parse Cron expressions and generate human-readable strings of Cron job schedules. It recognizes all special characters used in Cron expressions, including * / , – ? L W, #, supports 5, 6 (with seconds or year), or 7 (with seconds and year) part cron expressions, and is compatible with Quartz Job Scheduler cron expressions.
It also supports internationalization with over 30 human languages, allowing you to output the Cron expression description in the user’s preferred language.
1. Install and import the cRonstrue.
# NPM $ npm i cronstrue
// node.js
const cronstrue = require('cronstrue');
// ES module
import cronstrue from 'cronstrue';
// Browser
<script src="/dist/cronstrue.min.js"></script>
<script>
var cronstrue = window.cronstrue;
</script> 2. To translate a Cron expression, just call the toString() function, passing in your expression as an argument:
cronstrue.toString("1 2 3 4 5")
// => At 02:01 AM, on day 3 of the month, and on Friday, only in April // CLI usage $ cronstrue 1 2 3 4 5
3. Localize the human-readable descriptions:
// node.js
const cronstrue = require('cronstrue');
require('cronstrue/locales/es');
// ES module
import cronstrue from 'cronstrue';
import 'cronstrue/locales/es';
// Browser
<script src="/dist/cronstrue.min.js"></script>
<script src="/locales/es.min.js"></script> cronstrue.toString("1 2 3 4 5", {
locale: "es"
}); 4. More configuration options.
cronstrue.toString("1 2 3 4 5", {
throwExceptionOnParseError: false,
verbose: false,
dayOfWeekStartIndexZero: true,
monthStartIndexZero: false,
use24HourTimeFormat: true,
}); v2.61.0 (05/08/2025)
v2.60.0 (05/02/2025)
v2.59.0 (04/08/2025)
v2.58.0 (04/06/2025)
v2.57.0 (03/26/2025)
v2.56.0 (03/03/2025)
v2.55.0 (02/22/2025)
v2.54.0 (01/31/2025)
v2.53.0 (01/15/2025)
v2.52.0 (11/21/2024)
v2.51.0 (10/28/2024)
v2.50.0 (05/06/2024)
v2.49.0 (04/02/2024)
v2.48.0 (02/05/2024)
v2.47.0 (12/02/2023)
v2.44.0 (11/16/2023)
v2.43.0 (11/13/2023)
v2.42.0 (11/13/2023)
v2.41.0 (10/24/2023)
v2.33.0 (10/23/2023)
v2.32.0 (09/07/2023)
v2.31.0 (08/15/2023)
v2.30.0 (08/14/2023)
v2.29.0 (08/09/2023)
The post Translate Cron Expressions Into Human-readable Strings – cRonstrue appeared first on CSS Script.
People are betting thousands of dollars on who will die at the end of the…
Batman was created more than 80 years ago and has starred in video games for…
Spider-Noir star Nicolas Cage has said he pushed for the Prime Video superhero series to…
Games Workshop has shocked Warhammer 40,000 fans by confirming a leak of plans to sell…
FORT WAYNE IND. (WOWO) One man is dead following a fiery early-morning crash at Lafayette…
The Hunt For Ben Solo fan campaign is still going, and its latest stunt saw…
This website uses cookies.