Skip to content

Commit

Permalink
Update ha-backup-overview-summary.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten committed Dec 31, 2024
1 parent 5ae4b4b commit d48c536
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,31 @@ class HaBackupOverviewBackups extends LitElement {
`;
}

const nextBackupDescription = this._nextBackupDescription(
this.config.schedule.state
);

if (!lastSuccessfulBackup) {
return html`
<ha-backup-summary-card
heading="No automatic backup available"
description="You have no automatic backups yet."
status="warning"
>
<ha-md-list>
<ha-md-list-item>
<ha-svg-icon slot="start" .path=${mdiCalendar}></ha-svg-icon>
<span slot="headline">${nextBackupDescription}</span>
</ha-md-list-item>
</ha-md-list>
</ha-backup-summary-card>
`;
}

const nextBackupDescription = this._nextBackupDescription(
this.config.schedule.state
);

const numberOfDays = differenceInDays(
// Subtract a few hours to avoid showing as overdue if it's just a few hours (e.g. daylight saving)
addHours(now, -OVERDUE_MARGIN_HOURS),
lastSuccessfulBackupDate
new Date(lastSuccessfulBackup.date)
);

const isOverdue =
Expand Down

0 comments on commit d48c536

Please sign in to comment.