widalarmeta: fix #2542

Fix check for active alarm, either remove brackets or add return for
filter in map
master
Erik Andresen 2023-02-03 07:45:22 +01:00
parent f609c6d9a8
commit f050b75e5b
3 changed files with 4 additions and 3 deletions

View File

@ -4,3 +4,4 @@
Add option to show seconds Add option to show seconds
0.03: Fix Bell not appearing on alarms > 24h and redrawing interval 0.03: Fix Bell not appearing on alarms > 24h and redrawing interval
Update to match the default alarm widget, and not show itself when an alarm is hidden. Update to match the default alarm widget, and not show itself when an alarm is hidden.
0.04: Fix check for active alarm

View File

@ -2,7 +2,7 @@
"id": "widalarmeta", "id": "widalarmeta",
"name": "Alarm & Timer ETA", "name": "Alarm & Timer ETA",
"shortName": "Alarm ETA", "shortName": "Alarm ETA",
"version": "0.03", "version": "0.04",
"description": "A widget that displays the time to the next Alarm or Timer in hours and minutes, maximum 24h (configurable).", "description": "A widget that displays the time to the next Alarm or Timer in hours and minutes, maximum 24h (configurable).",
"icon": "widget.png", "icon": "widget.png",
"type": "widget", "type": "widget",

View File

@ -9,10 +9,10 @@
function draw() { function draw() {
const times = alarms const times = alarms
.map(alarm => { .map(alarm =>
alarm.hidden !== true alarm.hidden !== true
&& require("sched").getTimeToAlarm(alarm) && require("sched").getTimeToAlarm(alarm)
}) )
.filter(a => a !== undefined); .filter(a => a !== undefined);
const next = times.length > 0 ? Math.min.apply(null, times) : 0; const next = times.length > 0 ? Math.min.apply(null, times) : 0;
let calcWidth = 0; let calcWidth = 0;