Skip to content

Build your personal knowledge base with Trilium Notes

fix(ocr): incorrect date display

Elian Dorane64887225729
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index 7a0652ce14..edfc604635 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2091,7 +2091,6 @@
"no_text_explanation": "This note has not been processed for OCR text extraction or no text was found.",
"failed_to_load": "Failed to load OCR text",
"extracted_on": "Extracted on: {{date}}",
- "unknown_date": "Unknown",
"process_now": "Process OCR",
"processing": "Processing...",
"processing_started": "OCR processing has been started. Please wait a moment and refresh.",
diff --git a/apps/client/src/widgets/type_widgets/ReadOnlyTextRepresentation.tsx b/apps/client/src/widgets/type_widgets/ReadOnlyTextRepresentation.tsx
index 5d801e0a77..5836f466d0 100644
--- a/apps/client/src/widgets/type_widgets/ReadOnlyTextRepresentation.tsx
+++ b/apps/client/src/widgets/type_widgets/ReadOnlyTextRepresentation.tsx
@@ -3,6 +3,7 @@ import { useEffect, useState } from "preact/hooks";
import { t } from "../../services/i18n";
import server from "../../services/server";
import toast from "../../services/toast";
+import { formatDateTime } from "../../services/utils";
import { TypeWidgetProps } from "./type_widget";
interface TextRepresentationResponse {
@@ -99,9 +100,11 @@ export default function ReadOnlyTextRepresentation({ note }: TypeWidgetProps) {
}}>
{state.text}
</pre>
- <div style={{ fontSize: "0.9em", color: "var(--muted-text-color)", marginTop: "10px", fontStyle: "italic" }}>
- {t("ocr.extracted_on", { date: state.extractedAt ? new Date(state.extractedAt).toLocaleString() : t("ocr.unknown_date") })}
- </div>
+ {state.extractedAt && (
+ <div style={{ fontSize: "0.9em", color: "var(--muted-text-color)", marginTop: "10px", fontStyle: "italic" }}>
+ {t("ocr.extracted_on", { date: formatDateTime(new Date(state.extractedAt)) })}
+ </div>
+ )}
</>
)}