使用later.js到synced-cron on meteor我在活动event.date
前一周安排通知。这里有3个例子,前2个功能但不受欢迎,第3个是我想要的非功能性尝试。
notify.js
:
SyncedCron.add({
name: id,
schedule: function(parser) {
// 1) This works as expected (but not what I want)
// Returns notification at 00:00 same date as event.
return parser.recur().on(event.date).fullDate();
// 2) This works as expected (but not what I want)
// Returns notification at 06:00 today.
return parser.recur().on(6).hour().before(event.date).fullDate();
// 2) This, and other permutations tried, does not work
// returns error: "Exception while invoking method
// 'scheduleNotification' TypeError: Cannot call method
// 'getTime' of undefined"
return parser.recur().hour(6).before(event.date).fullDate();
},
job: function() {
notify();
}
});
有人可以建议在日期对象之前设置给定时间的通知吗?谢谢!