Added handling for 'rp:true' and also debug message in case of invalid repeat type

master
Gordon Williams 2023-03-07 11:41:21 +00:00 committed by GitHub
parent 871566ed0b
commit e87e3f137b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -84,6 +84,9 @@ function showAlarm(alarm) {
let date = new Date(alarm.date);
let rp = alarm.rp;
switch(rp.interval) {
case true:
date.setDate(date.getDate() + 1);
break;
case "day":
date.setDate(date.getDate() + rp.num);
break;
@ -100,6 +103,9 @@ function showAlarm(alarm) {
date = new Date(date.getFullYear() + rp.num, date.getMonth(), alarm.od);
if (date.getDate() != alarm.od) date.setDate(0);
break;
default:
console.log(`sched: unknown repeat '${JSON.stringify(rp)}'`);
break;
}
alarm.date = date.toLocalISOString().slice(0,10);
}