Lord Corwin
Lord Corwin

Reputation: 19

using Later.js for schedule

been trying to use the later.js with no luck here is how i do it

var hour = document.getElementById("starthour").value;

var minute= document.getElementById("startminute").value;

var time = "'0 "+ minute +" " + hour + " " + "? * SUN-THU'";

var s = later.parse.cron(time);

var timer = later.setInterval(checkWhoIsMissing, s);

help will be appreciated

Upvotes: 0

Views: 614

Answers (1)

Lord Corwin
Lord Corwin

Reputation: 19

to answer my own question there was a problem with my time definition best way to figure out a time is to look at

http://www.nncron.ru/help/EN/working/cron-format.htm

in general the format should be

Minute Hour Dayofthemonth Monthoftheyear DayoftheWeek

if you don't use one of them you need to put a star instead

sample

0 16 * * 0-5

which yields

16:00 on sun through Friday every month every year

another thing that helps is to write a simple schedule

for example

var results = later.schedule(s).next(5);
  for (var i = 0; i < results.length; i++) {
    alert( results[i].toLocaleString());

  } 

so you can see right away what are the next scheduled times.

hope that helps

"Be well do good keep in touch"

Upvotes: 1

Related Questions