Merge pull request #3380 from bobrippling/fix/sched-snooze

sched: fix snoozing an alarm after the snooze period
pull/3381/head
Gordon Williams 2024-04-23 10:50:57 +01:00 committed by GitHub
commit 47b5182443
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 2 deletions

View File

@ -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

View File

@ -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",

View File

@ -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 {