イベントの 1 週間前に通知をスケジュールしています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();
}
});
日付オブジェクトの前に特定の時間に通知を設定する方法を誰かが提案できますか? ありがとう!