shawnchin / jquery-cron

A jQuery plugin to provide a simplified interface for users to specify cron entries
http://shawnchin.github.io/jquery-cron
MIT License
177 stars 118 forks source link

Invalid initial value error - When using cron format with 1-5 or 1-7 weekday. #32

Open durnote opened 7 years ago

durnote commented 7 years ago

My cron string format uses 1-5 or 1-7 for week day part. But looks like not supported in your script. Example: 15 9 1-5 (which is 9:15 every day from Monday to Friday) is throwing an error: Invalid initial value.

I think this function in your code should be modified to handle 1-5 or 1-7. If this is possible, could you please help or advise.

`
// check format of initial cron value

    var valid_cron = /^((\d{1,2}|\*)\s){4}(\d{1,2}|\*)$/

    if (typeof cron_str != "string" || !valid_cron.test(cron_str)) {

        $.error("cron: invalid initial value");

        return undefined;

    }`
bakeevdr commented 4 years ago

my expression "0 / 6 " does not pass