Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: add missing ele for backup updates

kashaf-ansari-devedc65cd1158b
diff --git a/apps/web/src/common/notices.ts b/apps/web/src/common/notices.ts
index 4894b0a85..53da628ee 100644
--- a/apps/web/src/common/notices.ts
+++ b/apps/web/src/common/notices.ts
@@ -98,7 +98,7 @@ export async function shouldAddBackupNotice() {
const lastBackupTime = await db.backup.lastBackupTime();
if (!lastBackupTime) {
- await db.backup.updateBackupTime();
+ await db.backup.updateBackupTime("partial");
return false;
}
@@ -210,7 +210,7 @@ async function saveBackup(mode: "full" | "partial" = "partial") {
{
text: strings.later(),
onClick: async () => {
- await db.backup.updateBackupTime();
+ await db.backup.updateBackupTime(mode);
openedToast?.hide();
openedToast = null;
},
diff --git a/apps/web/src/dialogs/settings/backup-export-settings.ts b/apps/web/src/dialogs/settings/backup-export-settings.ts
index c39c40e89..b6dad6943 100644
--- a/apps/web/src/dialogs/settings/backup-export-settings.ts
+++ b/apps/web/src/dialogs/settings/backup-export-settings.ts
@@ -26,6 +26,7 @@ import { useStore as useSettingStore } from "../../stores/setting-store";
import { useStore as useAppStore } from "../../stores/app-store";
import { useStore as useUserStore } from "../../stores/user-store";
import { desktop } from "../../common/desktop-bridge";
+import { formatDate } from "@notesnook/core";
import dayjs from "dayjs";
function getNextBackupTime(
@@ -60,12 +61,16 @@ export const BackupExportSettings: SettingsGroup[] = [
const partial = s.lastBackupTime || 0;
const full = s.lastFullBackupTime || 0;
const last = Math.max(partial, full);
-
+
if (!last) return strings.backupNowDesc();
-
+
const typeStr = last === full ? " (Full)" : " (Partial)";
return `${strings.backupNowDesc()}\n${strings.lastBackupOn(
- dayjs(last).format("MMM D, YYYY [at] h:mm A")
+ formatDate(last, {
+ type: "date-time",
+ dateFormat: s.dateFormat,
+ timeFormat: s.timeFormat
+ })
)}${typeStr}`;
},
onStateChange: (listener) =>
@@ -112,15 +117,20 @@ export const BackupExportSettings: SettingsGroup[] = [
key: "auto-backup",
title: strings.automaticBackups(),
description: () => {
+ const s = useSettingStore.getState();
const next = getNextBackupTime(
- useSettingStore.getState().backupReminderOffset,
- useSettingStore.getState().lastBackupTime,
+ s.backupReminderOffset,
+ s.lastBackupTime,
false
);
return next
? `${strings.automaticBackupsDesc()}\n${strings.nextBackupOn(
- dayjs(next).format("MMM D, YYYY [at] h:mm A")
- )}`
+ formatDate(next, {
+ type: "date-time",
+ dateFormat: s.dateFormat,
+ timeFormat: s.timeFormat
+ })
+ )}`
: strings.automaticBackupsDesc();
},
onStateChange: (listener) =>
@@ -155,16 +165,23 @@ export const BackupExportSettings: SettingsGroup[] = [
key: "auto-backup-with-attachments",
title: strings.automaticBackupsWithAttachments(),
description: () => {
+ const s = useSettingStore.getState();
const next = getNextBackupTime(
- useSettingStore.getState().fullBackupReminderOffset,
- useSettingStore.getState().lastFullBackupTime,
+ s.fullBackupReminderOffset,
+ s.lastFullBackupTime,
true
);
- const base = strings.automaticBackupsWithAttachmentsDesc().join("\n\n");
+ const base = strings
+ .automaticBackupsWithAttachmentsDesc()
+ .join("\n\n");
return next
? `${base}\n${strings.nextBackupOn(
- dayjs(next).format("MMM D, YYYY [at] h:mm A")
- )}`
+ formatDate(next, {
+ type: "date-time",
+ dateFormat: s.dateFormat,
+ timeFormat: s.timeFormat
+ })
+ )}`
: base;
},
onStateChange: (listener) =>