Skip to content

Build your personal knowledge base with Trilium Notes

Sort the backup files by date & time

Adorian Doran32a4a9c072d1
diff --git a/src/public/app/widgets/type_widgets/options/backup.js b/src/public/app/widgets/type_widgets/options/backup.js
index dd51d0d7f3..f68fcb0dde 100644
--- a/src/public/app/widgets/type_widgets/options/backup.js
+++ b/src/public/app/widgets/type_widgets/options/backup.js
@@ -98,6 +98,13 @@ export default class BackupOptions extends OptionsWidget {
backupFiles = [{filePath: t('backup.no_backup_yet'), mtime: ''}];
}
+ // Sort the backup files by modification date & time in a desceding order
+ backupFiles.sort((a, b) => {
+ if (a.mtime < b.mtime) return 1;
+ if (a.mtime > b.mtime) return -1;
+ return 0;
+ });
+
const dateTimeFormatter = new Intl.DateTimeFormat(navigator.language, {
dateStyle: "medium",
timeStyle: "medium"