From a4b5a0e8f57b1be6ec95548edf0f14d9c38d0a28 Mon Sep 17 00:00:00 2001 From: Aditya Chandel <8075870+adityachandelgit@users.noreply.github.com> Date: Tue, 7 Oct 2025 14:00:42 -0600 Subject: [PATCH] Fix: Books publish date incorrect when moved (#1289) --- .../file-mover-component/file-mover-component.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/booklore-ui/src/app/utilities/component/file-mover-component/file-mover-component.ts b/booklore-ui/src/app/utilities/component/file-mover-component/file-mover-component.ts index 3875f104f..6f09cd0a3 100644 --- a/booklore-ui/src/app/utilities/component/file-mover-component/file-mover-component.ts +++ b/booklore-ui/src/app/utilities/component/file-mover-component/file-mover-component.ts @@ -145,9 +145,7 @@ export class FileMoverComponent implements OnDestroy { applyPattern(): void { this.filePreviews = this.books.map(book => { - const meta = book.metadata!; const fileName = book.fileName ?? ''; - const extension = fileName.match(/\.[^.]+$/)?.[0] ?? ''; const fileSubPath = book.fileSubPath ? `${book.fileSubPath.replace(/\/+$/g, '')}/` : ''; const relativeOriginalPath = `${fileSubPath}${fileName}`; @@ -155,7 +153,6 @@ export class FileMoverComponent implements OnDestroy { const currentLibraryId = book.libraryId ?? book.libraryPath?.id ?? (book as any).library?.id ?? null; const currentLibraryName = this.getLibraryNameById(currentLibraryId); - // Initially set target library to current library const targetLibraryId = currentLibraryId; const targetLibraryName = currentLibraryName; @@ -265,8 +262,12 @@ export class FileMoverComponent implements OnDestroy { formatYear(dateStr?: string): string { if (!dateStr) return ''; + const yearMatch = dateStr.match(/^(\d{4})/); + if (yearMatch) { + return yearMatch[1]; + } const date = new Date(dateStr); - return isNaN(date.getTime()) ? '' : date.getFullYear().toString(); + return isNaN(date.getTime()) ? '' : date.getUTCFullYear().toString(); } formatSeriesIndex(seriesNumber?: number): string {