假设我的日期为x = 12 y = 45,我想每天12:45使用议程节点js执行任务。所以我的问题是,
如何将日期从js变量传递给Agenda.schedule("at x:y",'doSometask')
答案 0 :(得分:0)
简单使用this.just在string中连接变量。
var x=12;
var y=45;
a = "at "+x+":"+y;
Agenda.schedule(a,'doSometask')
答案 1 :(得分:0)
var x=14;
var y=23;
var z=x-2;
a = "at "+z+":"+y;
agenda.define('init', function (job) {
console.log("INIT AGENDA");
//job.schedule(a);
//job.save();
});
agenda.on('ready', function () {
console.log("Agenda ready to start");
agenda.schedule(a,'init');
agenda.start();
});
这对我有用!!