From 32a4a9c072d17972fc6fc99fc5fb6db74d6301f7 Mon Sep 17 00:00:00 2001 From: Adorian Doran Date: Tue, 19 Nov 2024 18:07:42 +0200 Subject: [PATCH] Sort the backup files by date & time --- src/public/app/widgets/type_widgets/options/backup.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/public/app/widgets/type_widgets/options/backup.js b/src/public/app/widgets/type_widgets/options/backup.js index dd51d0d7f..f68fcb0dd 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"