Skip to content

[repo:objectui] Pure date fields within ±7 days render as relative text ('3天前') in lists and detail — unconditional in the date formatter, so a period-end business date loses its value #14885

Description

@baozhoutao

Summary

A pure date field (no time component, a business date such as a period end) is rendered as relative text whenever the value is within ±7 days of today: 3天前, 明天, 昨天. Outside that window it renders the calendar date. In a list this produces two visually different formats in the same column set, and the relative text hides the actual date a user needs to read (an assessment period end is a business date, not a "how long ago" fact).

Minimal reproduction

Platform 17.2.0 console, today = 2026-09-03.

Object kpi_plan with period_start: Field.date({ label: '周期开始' }) = 2026-08-01 and period_end: Field.date({ label: '周期结束' }) = 2026-08-31.

List view columns period_start, period_end:

周期开始   8月1日      ← calendar date (34 days ago, outside the window)
周期结束   3天前       ← relative (3 days ago, inside the window)

Detail page shows the same. The audit timestamps (created_at etc.) are datetimes and are a separate case.

Where

ui-components chunk, date display formatter:

function Ltt(e, t) {
  ...
  let o = Math.round((dateOnly(value) - dateOnly(today)) / 864e5);
  if (o < -7 || o > 7) return k9(n, void 0, t);          // calendar date
  if (o < -1 && t?.dueLike) return t.t('fields.relativeDate.overdue', {count: -o}) ...
  return Itt(o, t?.locale);                               // Intl.RelativeTimeFormat(..., 'day')
}

The relative branch is unconditional for the ±7-day window; dueLike only changes the wording.

Expected

  • date fields render the calendar date by default, in both list cells and detail pages. A business date is a value the user reads and compares; relative wording loses the value.
  • Relative wording should be opt-in per field / column (e.g. display: 'relative', or only when the field is flagged dueLike), or shown as a secondary hint (tooltip / muted suffix) next to the actual date.
  • If the default must stay relative, at least apply it consistently (both 8月1日 and 3天前 in one row is the worst of both).

Environment

@objectstack/console 17.2.0 · objectstack dev · Chrome · locale zh-CN. App: objectstack-ai/kpi, object kpi_plan.

Activity

  1. added theissue type on Sep 10, 2026
  2. huangyiirene commented on Sep 10, 2026

    @huangyiirene
    Collaborator

    Triage: lands in objectstack-ai/objectui (the list/detail date formatter) ⇒ repo:objectui; type Bug; priority:p3 unchanged; pm:queue.

    Rationale: a rendering choice in the console's date formatter; no objectstack surface is implicated. Already repo:objectui; the missing piece was a state label.

    ⭐ Read together with #14887, and ⛔ do not merge them. The card says so itself and it is right — the two sit in the same formatter but are different defects:

    • this card — a presentation choice: a pure date inside ±7 days renders as relative text (3天前) while the same column's neighbour renders as a calendar date. The value is correct.
    • #14887 — a correctness defect: the same formatter shifts a pure date by one day west of UTC (2026-08-01 → 7月31日).

    ⇒ One PR may well touch both, but they need separate acceptance: fixing the timezone handling does not decide whether a business date should ever be rendered relatively, and suppressing the relative rendering would mask objectstack-ai/objectui#10110 rather than fix it. Recorded here so a family-fold does not quietly collapse two judgements into one.

    priority:p3 stands for this half (presentation); objectstack-ai/objectui#10110 keeps p2 for the correctness half — that asymmetry is deliberate.

    Triage seat · session_013hshVTmHY5F7rhpNtYHa3m · R+165 · 2026-09-10T01:0xZ


    Generated by Claude Code

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

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions