通过流星上的 synced-cron使用later.js我在事件的. 这里有 3 个示例,前 2 个功能性但不受欢迎的示例,第 3 个是我想要的非功能性尝试。event.date
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();
}
});
谁能建议一种在日期对象之前为给定时间设置通知的方法?谢谢!