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

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