Skip to content

bug(i18n): TodayView.formatWhen 仍走宿主 OS 区域短日期 #410

Open

Description

@wannT-1

背景

#292 / #293 已把 UI 包内多处内联 toLocale* 收进 @finagent/i18n 统一层,但 PR #293 正文刻意未纳入 TodayView 的短日期形状:

刻意未纳入 components/today/TodayView.tsx 的 formatWhen…统一层没有该短日期形状的等价实现。

该遗留在当前 main 仍在。

现象

packages/ui/src/components/today/TodayView.tsx 的 formatWhen:超过一天时使用

return new Date(timestamp).toLocaleDateString(undefined, { month: 'short', day: 'numeric' })

undefined locale → 跟随宿主 OS,与 packages/i18n / packages/ui/src/lib/money.ts「应用语言决定呈现、OS 区域不参与」的契约相反。

影响今日页:触发提醒时间戳、待复核论点时间戳等超过 24h 的展示。

预期

  • 应用语言为 zh-CN 时短日期由应用语言控制(形状可与 RuleCard 既有先例对齐:Intl.DateTimeFormat(i18nCurrentLocale(), { month:'short', day:'numeric' }))。
  • 应用语言为 en-US 时同理。
  • 不把年份硬塞进短日期(避免 Nov 21 → Nov 21, 2024 的形状扩张,除非产品明确要求)。

建议修复(小范围)

任选其一并保持 focused:

  1. 在 i18n 层新增 formatShortDate(month short + day numeric,无 year),供 Today / RuleCard 共用;或
  2. 仅在 formatWhen 内改用 Intl.DateTimeFormat(i18nCurrentLocale(), { month:'short', day:'numeric' }),与 RuleCard 一致。

补一条与 #293 守卫同风格的回归:宿主 locale 与应用 locale 不一致时,断言输出跟应用语言走。

范围

仅 Today(及可选抽出共享 short-date helper)。不重开 #292 已覆盖的 8 处站点。无布局变化,仅日期字符串来源。

查重

#292/#293 已声明此为后续项;未见独立 follow-up issue。

Activity

  1. wannT-1 commented on Oct 30, 2026

    @wannT-1
    Author

    /claim

    我来收 TodayView.formatWhen 的短日期:改用应用语言(与 RuleCard 先例对齐,或抽出 formatShortDate),并补宿主 locale ≠ 应用 locale 的回归。提交 PR 时写 Closes #410。

  2. github-actions commented on Oct 30, 2026

    @github-actions

    @wannT-1 已认领该 Issue,并已自动设为 Assignee。提交 PR 时请在描述中写 Closes #410。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

claimedClaimed by a contributor and currently in progress

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions