🚑 Fix crash if next_backup is empty (if auto backup not configured) #84

This commit is contained in:
Sebastien Clement 2021-09-14 09:58:04 +02:00
parent cf98379de9
commit 7b7d5a2b0e
No known key found for this signature in database
GPG Key ID: 6C78A38312BBA4B6
2 changed files with 3 additions and 3 deletions

View File

@ -77,7 +77,7 @@ class CronContainer {
updateNextDate() {
let date;
if (this.cronJob == null) date = "Not configured";
if (this.cronJob == null) date = null;
else date = this.cronJob.nextDate().format("MMM D, YYYY HH:mm");
let status = statusTools.getStatus();
status.next_backup = date;

View File

@ -550,8 +550,8 @@ function publish_state(state){
error_code: state.error_code,
message: state.message,
icon: icon,
last_backup: state.last_backup == null ? "" : new Date(state.last_backup).toISOString(),
next_backup: state.next_backup == null ? "" : new Date(state.next_backup).toISOString()
last_backup: state.last_backup == null || state.last_backup == "" ? "" : new Date(state.last_backup).toISOString(),
next_backup: state.next_backup == null || state.next_backup == "" ? "" : new Date(state.next_backup).toISOString()
},
}
option.json = data_state_sensor