cRonstrue is available as a UMD module, allowing it to function in an AMD, CommonJS, or browser global environment.
To start using the module, begin by installing it:
npm install cronstrue
After installation, depending on your specific context of use, import the module accordingly:
Below are some usage examples showcasing how cRonstrue interprets different cron expressions:
TypeScript
import cronstrue from 'cronstrue';
cronstrue.toString("* * * * *");
> "Every minute"
cronstrue.toString("0 23 ? * MON-FRI");
> "At 11:00 PM, Monday through Friday"
cronstrue.toString("23 12 * * SUN#2");
> "At 12:23 PM, on the second Sunday of the month"
cronstrue.toString("* * * ? * 2-6/2", { dayOfWeekStartIndexZero: false});
> "Every second, every 2 days of the week, Monday through Friday"
cronstrue.toString("* * * * *");
"Every minute"
cronstrue.toString("0 23 ? * MON-FRI");
"At 11:00 PM, Monday through Friday"
cronstrue.toString("23 12 * * SUN#2");
"At 12:23 PM, on the second Sunday of the month"
cronstrue.toString("* * * ? * 2-6/2", { dayOfWeekStartIndexZero: false});
"Every second, every 2 days of the week, Monday through Friday"
For more usage examples and information, visit https://www.npmjs.com/package/cronstrue