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 246 forks source link

Uncaught Error: Definition must include at least one schedule. #148

Closed fabiomig closed 8 years ago

fabiomig commented 8 years ago

`var sched = {schedules: [ {h: [12], m: [08]}, {h: [17], m: [30]} ]};

var c = new Date(); var month = c.getMonth(); var year = c.getFullYear(); var day = c.getDay(); var hours = c.getHours(); var minutes = c.getMinutes();

var teste = later.schedule(sched);

later.setInterval(function(){console.log(new Date());}, teste);`

what is wrong?

bunkat commented 8 years ago

You just need to pass in the JSON schedule object.

later.setInterval(function(){console.log(new Date());}, sched);