diff --git a/apps/sched/ChangeLog b/apps/sched/ChangeLog index b90f7ebbc..a2d6c370f 100644 --- a/apps/sched/ChangeLog +++ b/apps/sched/ChangeLog @@ -1,3 +1,4 @@ 0.01: New App! 0.02: Fix scheduling of other alarms if there is a pending alarm from the past (fix #1667) 0.03: Fix `getTimeToAlarm` for a timer already used at same day, don't set `last` for timers. +0.04: Fix `getTimeToAlarm` to check for next dow if alarm.t lower currentTime. diff --git a/apps/sched/lib.js b/apps/sched/lib.js index d55a05475..1189fa275 100644 --- a/apps/sched/lib.js +++ b/apps/sched/lib.js @@ -37,9 +37,9 @@ exports.setAlarm = function(id, alarm) { exports.getTimeToAlarm = function(alarm, time) { if (!alarm) return undefined; if (!time) time = new Date(); - var active = alarm.on && (alarm.dow>>time.getDay())&1 && (!alarm.date || alarm.date==time.toISOString().substr(0,10)); - if (!active) return undefined; var currentTime = (time.getHours()*3600000)+(time.getMinutes()*60000)+(time.getSeconds()*1000); + var active = alarm.on && (alarm.dow>>(time.getDay()+(alarm.t