-1

Any example is there for cronstrue concept for converting cron expressions into human readable strings in Angular 4.

I need library or plugin in angular 4 for converting cronjobs schedule expressions into human readable strings[cronstrue].

If i use cron_expression as :-

"0 15 * * * ?"

the result what is i need exactly as a string followed by

"At second :00 of minute :15 of every hour"

D.Sridhar
  • 139
  • 1
  • 4
  • 11

1 Answers1

1

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

Suresh Sekar
  • 928
  • 6
  • 7