cRonstrue is exported as an UMD module so it will work in an AMD, CommonJS or browser global context.
First, install the module:
npm install cronstrue
Then, depending upon your usage context, add a reference to it:
For more usage examples, including a demonstration of how cRonstrue can handle some very
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, including a demonstration https://www.npmjs.com/package/cronstrue