From f853f424e02400f33f55b61c5562478de4e1bce3 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Tue, 17 Feb 2026 13:01:25 -0800 Subject: [PATCH] Actually these are not Dates --- .../document-detail.component.spec.ts | 10 +++++----- .../document-detail/document-detail.component.ts | 14 +++----------- src-ui/src/app/data/document.ts | 8 ++++---- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src-ui/src/app/components/document-detail/document-detail.component.spec.ts b/src-ui/src/app/components/document-detail/document-detail.component.spec.ts index df1585997..879cde41e 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.spec.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.spec.ts @@ -83,9 +83,9 @@ const doc: Document = { storage_path: 31, tags: [41, 42, 43], content: 'text content', - added: new Date('May 4, 2014 03:24:00'), - created: new Date('May 4, 2014 03:24:00'), - modified: new Date('May 4, 2014 03:24:00'), + added: new Date('May 4, 2014 03:24:00').toISOString(), + created: new Date('May 4, 2014 03:24:00').toISOString(), + modified: new Date('May 4, 2014 03:24:00').toISOString(), archive_serial_number: null, original_file_name: 'file.pdf', owner: null, @@ -524,7 +524,7 @@ describe('DocumentDetailComponent', () => { jest.spyOn(documentService, 'get').mockReturnValue( of({ ...doc, - modified: new Date('2024-01-02T00:00:00Z'), + modified: '2024-01-02T00:00:00Z', duplicate_documents: updatedDuplicates, }) ) @@ -1395,7 +1395,7 @@ describe('DocumentDetailComponent', () => { }) // simulate a document being modified elsewhere and db updated const remoteDoc = Object.assign({}, doc, { - modified: new Date(new Date(doc.modified).getTime() + 1000), + modified: new Date(new Date(doc.modified).getTime() + 1000).toISOString(), }) jest .spyOn(activatedRoute, 'paramMap', 'get') diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index 1917a6707..341bb030e 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -492,7 +492,7 @@ export class DocumentDetailComponent ) } - private showIncomingUpdateModal(modified?: string | Date): void { + private showIncomingUpdateModal(modified?: string): void { if (this.incomingUpdateModal) return const modal = this.modalService.open(ConfirmDialogComponent, { @@ -540,12 +540,6 @@ export class DocumentDetailComponent this.handleIncomingDocumentUpdated(pendingUpdate) } - private getModifiedRawValue(modified: string | Date): string | null { - if (!modified) return null - if (typeof modified === 'string') return modified - return modified.toISOString() - } - private loadDocument(documentId: number, forceRemote: boolean = false): void { let redirectedToRoot = false this.closeIncomingUpdateModal() @@ -681,7 +675,7 @@ export class DocumentDetailComponent } // If modified timestamp of the incoming update is the same as the last local save, // we assume this update is from our own save and dont notify - const incomingModified = this.getModifiedRawValue(data.modified) + const incomingModified = data.modified if ( incomingModified && this.lastLocalSaveModified && @@ -1208,9 +1202,7 @@ export class DocumentDetailComponent .subscribe({ next: (docValues) => { this.closeIncomingUpdateModal() - this.lastLocalSaveModified = this.getModifiedRawValue( - docValues.modified - ) + this.lastLocalSaveModified = docValues.modified ?? null // in case data changed while saving eg removing inbox_tags this.documentForm.patchValue(docValues) const newValues = Object.assign({}, this.documentForm.value) diff --git a/src-ui/src/app/data/document.ts b/src-ui/src/app/data/document.ts index 74946b332..d33b64248 100644 --- a/src-ui/src/app/data/document.ts +++ b/src-ui/src/app/data/document.ts @@ -128,15 +128,15 @@ export interface Document extends ObjectWithPermissions { checksum?: string // UTC - created?: Date + created?: string // ISO string - modified?: Date + modified?: string // ISO string - added?: Date + added?: string // ISO string mime_type?: string - deleted_at?: Date + deleted_at?: string // ISO string original_file_name?: string