prettyCron
prettyCron is a simple JavaScript deuglifier for cron schedules: it prints out a human-readable interpretation of when the schedule will run.
For examples...
... check out the project home page.
Installation - browser
Include prettycron.js after adding moment.js and later.js.
Installation - Node
Simply use npm
and require
:
$ npm install prettycron
var prettyCron = ;
Usage
prettyCron exposes two methods, both of which take a cron specification as the only argument.
prettyCron.toString(cron)
Returns a human-readable sentence describing all the times this cron will run.
prettyCron;// returns "10:37 every day"
prettyCron.getNext(cron)
Returns a string representing the next time this cron will run, formatted with moment's calendar() method.
prettyCron;// if current time is 4:45pm, then returns "Today at 5:00 PM"
Credits
prettyCron was originally written by dunse and posted to gist. This version is by Hourann Bosci with contributions from Johan Andersson, Phil Jepsen, Andre Buchanan, and Anton Petrov.
It's licensed under LGPLv3.