Skip to content

Commit

Permalink
Use difference in days
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya committed Dec 10, 2024
1 parent 018afcd commit daca203
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { differenceInDays } from "date-fns";
import { html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import memoizeOne from "memoize-one";
Expand Down Expand Up @@ -47,8 +48,7 @@ export class HaBackupSummaryProgress extends LitElement {
}

const lastBackupDate = new Date(lastBackup.date);
const lastBackupPeriod = new Date().getTime() - lastBackupDate.getTime();
const numberOfDays = Math.floor(lastBackupPeriod / (1000 * 60 * 60 * 24));
const numberOfDays = differenceInDays(new Date(), lastBackupDate);

// TODO : Improve time format
const description = `Last successful backup ${formatShortDateTime(lastBackupDate, this.hass.locale, this.hass.config)} and synced to ${lastBackup.agent_ids?.length} locations`;
Expand Down

0 comments on commit daca203

Please sign in to comment.