Skip to content

Commit

Permalink
Merge pull request #3380 from bobrippling/fix/sched-snooze
Browse files Browse the repository at this point in the history
sched: fix snoozing an alarm after the snooze period
  • Loading branch information
gfwilliams committed Apr 23, 2024
2 parents 278be08 + bf0eb8a commit 47b5182
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/sched/ChangeLog
Expand Up @@ -26,3 +26,4 @@
0.23: Allow buzzing forever when an alarm fires
0.24: Emit alarmReload when alarms change (used by widalarm)
0.25: Fix wrap around when snoozed through midnight
0.26: Fix hitting snooze on an alarm after when the snooze would've fired
2 changes: 1 addition & 1 deletion apps/sched/metadata.json
@@ -1,7 +1,7 @@
{
"id": "sched",
"name": "Scheduler",
"version": "0.25",
"version": "0.26",
"description": "Scheduling library for alarms and timers",
"icon": "app.png",
"type": "scheduler",
Expand Down
4 changes: 3 additions & 1 deletion apps/sched/sched.js
Expand Up @@ -35,7 +35,9 @@ function showAlarm(alarm) {
if (alarm.ot === undefined) {
alarm.ot = alarm.t;
}
alarm.t += settings.defaultSnoozeMillis;
let time = new Date();
let currentTime = (time.getHours()*3600000)+(time.getMinutes()*60000)+(time.getSeconds()*1000);
alarm.t = currentTime + settings.defaultSnoozeMillis;
alarm.t %= 86400000;
Bangle.emit("alarmSnooze", alarm);
} else {
Expand Down

0 comments on commit 47b5182

Please sign in to comment.