bunkat / later

A javascript library for defining recurring schedules and calculating future (or past) occurrences for them. Includes support for using English phrases and Cron schedules. Works in Node and in the browser.
http://bunkat.github.io/later/
MIT License
2.42k stars 244 forks source link

Can I get crontab formated string from compiled schedule ? #187

Closed stolendog closed 7 years ago

stolendog commented 8 years ago

var sched = later.parse.recur().on(10).minute().on(8).hour()

is there any way to get cron sting like "10 8 * * *" from shedule above?

marcacyr commented 8 years ago

+1

bunkat commented 7 years ago

No, there has been talk of various people implementing this but I don't think anything has come from it. Being an API for generating cron statements was never a goal (the fact that it supports cron at all is kind of a fluke, personally I've never even used that functionality).

krazyjakee commented 4 years ago

Sad to see this issue is closed. For the life of me I cannot find a library that converts natural language to cron strings. This library is sooo close.

marcacyr commented 4 years ago

@krazyjakee a few years ago, I managed to get something working using https://github.com/azza-bazoo/prettycron

It was able to take strings like " 25 12 *" and convert it to a cron job, and it would display the schedule in human-readable form "Every minute on the 25th in December"

It was able to handle anything thrown at it, and got a lot of love at RSA that year when it was part of the demo for the company I was with at the time.

Using the nextRun function, it could also display to the user when the next run would happen... it was pretty easy if I remember right.

Check it out! Hope this helps!

krazyjakee commented 4 years ago

I'm looking for the opposite. To take a human readable string and output a Cron string like in this issue description.