diff --git a/apps/web/src/components/EditorPane.tsx b/apps/web/src/components/EditorPane.tsx index 8165e880..caad833b 100644 --- a/apps/web/src/components/EditorPane.tsx +++ b/apps/web/src/components/EditorPane.tsx @@ -114,7 +114,7 @@ import { ShareNoteImageDialog, type ShareNoteImageSource } from "./dialogs/Share import { AiAssistantDialog, type AiAssistantAnchor } from "./dialogs/AiAssistantDialog"; import { api } from "@/lib/api"; import { isDesktopResourceRuntime, stageDesktopResource, toDesktopResourceUrl } from "@/lib/desktop-resources"; -import { cn, formatDateTime, formatLocalizedDateTime, parseTagsText } from "@/lib/utils"; +import { cn, formatDateTime, parseTagsText } from "@/lib/utils"; import { EDITOR_CONTENT_MAX_WIDTH, EDITOR_CONTENT_MAX_WIDTH_COLLAPSED } from "@/lib/workspace-ui"; import { countMemoCharacters, @@ -3639,9 +3639,7 @@ const RichEditorPane = ({ ? "bg-emerald-50 text-emerald-700" : saveStateClassName; - const memoDateLocale = i18n.resolvedLanguage ?? i18n.language; - const createdLabel = formatLocalizedDateTime(memo.createdAt, memoDateLocale); - const updatedLabel = formatLocalizedDateTime(memo.updatedAt, memoDateLocale); + const updatedLabel = formatDateTime(memo.updatedAt); const currentNotebookLabel = notebookOptions.find((notebook) => notebook.id === memo.notebookId)?.name ?? t("editor.notebookFallback"); const currentMarkdownForAi = getCurrentMarkdownForAi(); @@ -3883,7 +3881,7 @@ const RichEditorPane = ({ - {t("editor.timestamps", { createdTime: createdLabel, updatedTime: updatedLabel })} + {t("editor.updatedAt", { time: updatedLabel })} diff --git a/apps/web/src/lib/utils.test.mjs b/apps/web/src/lib/utils.test.mjs index c43d92f0..64272aaa 100644 --- a/apps/web/src/lib/utils.test.mjs +++ b/apps/web/src/lib/utils.test.mjs @@ -1,5 +1,5 @@ import { describe, expect, test } from "bun:test"; -import { buildNotebookTree, formatLocalizedDateTime, parseTagsText } from "./utils.ts"; +import { buildNotebookTree, parseTagsText } from "./utils.ts"; const notebook = (id, parentId, memoCount, lastMemoUpdatedAt = null) => ({ id, @@ -65,13 +65,3 @@ describe("tag text parsing", () => { ]); }); }); - -describe("localized date formatting", () => { - test("includes the year for historical memo timestamps", () => { - expect(formatLocalizedDateTime("2010-08-30T12:34:00.000Z", "en-US")).toContain("2010"); - }); - - test("fails gracefully for invalid timestamps", () => { - expect(formatLocalizedDateTime("not-a-date", "zh-CN")).toBe(""); - }); -}); diff --git a/apps/web/src/lib/utils.ts b/apps/web/src/lib/utils.ts index 3382c256..70117d46 100644 --- a/apps/web/src/lib/utils.ts +++ b/apps/web/src/lib/utils.ts @@ -57,19 +57,6 @@ export const formatDateTime = (value: string) => minute: "2-digit", }).format(new Date(value)); -export const formatLocalizedDateTime = (value: string, locale: string) => { - const date = new Date(value); - if (Number.isNaN(date.getTime())) return ""; - - return new Intl.DateTimeFormat(locale, { - year: "numeric", - month: "numeric", - day: "numeric", - hour: "2-digit", - minute: "2-digit", - }).format(date); -}; - export const parseTagsText = (value: string) => value .split(/[,,\n]+/) diff --git a/packages/shared/src/i18n/en-US.ts b/packages/shared/src/i18n/en-US.ts index b3873b74..6d194ec0 100644 --- a/packages/shared/src/i18n/en-US.ts +++ b/packages/shared/src/i18n/en-US.ts @@ -1427,7 +1427,6 @@ export const enUS = { enableReadingProtection: "Enable reading protection", disableReadingProtection: "Disable reading protection and edit", updatedAt: "Updated {{time}}", - timestamps: "Created {{createdTime}} · Updated {{updatedTime}}", done: "Done", uploadAttachment: "Upload attachment", collapseFormat: "Collapse formatting", diff --git a/packages/shared/src/i18n/zh-CN.ts b/packages/shared/src/i18n/zh-CN.ts index d6b240c5..95c43aa8 100644 --- a/packages/shared/src/i18n/zh-CN.ts +++ b/packages/shared/src/i18n/zh-CN.ts @@ -1427,7 +1427,6 @@ export const zhCN = { enableReadingProtection: "开启阅读保护", disableReadingProtection: "关闭阅读保护并进入编辑", updatedAt: "更新于 {{time}}", - timestamps: "创建于 {{createdTime}} · 更新于 {{updatedTime}}", done: "完成", uploadAttachment: "上传附件", collapseFormat: "收起格式",