Repository navigation
Commit 9c3097e
fix(fields,plugin-grid): a grid date column reads in one absolute face (#26341)
Fixes #25884
Clause-②: no
Metadata-protocol: none
## What changes
A list grid's `date` column used to mix three faces in one column, for
example "Yesterday · 3 days ago · Sep 25 · Sep 20, 2025". The cause was
`DateCellRenderer`, which defaulted an undeclared `format` to
`'relative'`. `formatRelativeDate` is relative only within ±7 days and
absolute outside that window.
This PR follows the seat's route on the 2026-10-25 ruling: absolute in a
sortable column, relative at most as a tooltip.
- **`@object-ui/fields`**
- `CellRendererProps` gains `inGridColumn?: boolean`.
- When `inGridColumn` is set and the `date` field declares no `format`,
`DateCellRenderer` paints `formatDate(v, undefined, …)`. That is the
locale's short absolute date, with the year shown only when it is not
the current year. No new formatter or i18n key is added, and
`date-display.ts` is untouched.
- The relative phrase the cell no longer paints ("Yesterday", "In 2
days", "Overdue 3d" on a declared `dueLike`) becomes the cell's `title`.
It replaces the raw ISO `title`, but only when the phrase differs from
the face. Outside the ±7-day window the phrase is the absolute face, so
the ISO `title` stays there.
- The overdue red is unchanged (`isOverdueInstant`).
- A declared `format` still wins, `'relative'` included.
- The `DateTimeCellRenderer` region is not touched.
- **`@object-ui/plugin-grid`**
- `ObjectGrid` passes `inGridColumn` on all seven column-cell call sites
`generateColumns` builds (paths A to D, link cells included).
- `temporalGroupHeading` restates the same selection (`format ||
undefined`), so a group heading still reads like the cell under it.
- Its record panel (`renderFieldValue`) and the mobile card's percent
slot draw their cells without the prop and keep the old default.
## Why a prop, not a shared flip
`DateCellRenderer` is shared by the record detail body, the header
highlights strip, kanban and gallery cards, the tree and RelatedList.
Flipping its default would change every one of those surfaces. The seat
asked that only grid columns change, and the prop is the seam for that.
It follows the precedent of `alwaysShowYear`, a host-declared
presentation input on the same props.
## Tests
- **Red first, then green.**
`ObjectGrid.dateColumnOneFace-25884.test.tsx` (new) drives every column
path of the real grid: A object `columns`, B string `columns`, C the
inline-data projection, D the object-schema default columns. One column
holds dates at −1, −3, −6, +2, −40 and −400 days.
- Before the fix (`4f461580`, the test alone on `e05e0de8`), 4/4 failed
with `expected 'Yesterday' not to match …`. The in-window rows painted
relative phrases and the out-of-window rows painted absolute dates.
- After the fix, 4/4 pass.
- The test also pins the tooltip (`Overdue 3d`, `In 2 days`,
`Yesterday`) and the red on a past `dueLike` row. Its control is a field
declaring `format: 'relative'`, which keeps "Yesterday" / "3 days ago".
- **Pins flipped.** One file,
`ui/packages/plugin-grid/src/__tests__/ObjectGrid.deadlineSettled-11815.test.tsx`
(7 cases). It read "Overdue 5d" / "5 days ago" / "4 days ago" as the
cell TEXT, which was the old default. It now reads them from the cell's
`title`, asserts the cell text is the absolute date, and still asserts
red on the open row and no red on the done row and on the undeclared
control.
- **Held unchanged.**
- `groupDateHeading-13234.test.tsx` holds every heading equal to its
cell for formats `undefined`, `'relative'`, `'short'` and
`'YYYY-MM-DD'`. It stays green because both sides moved together.
- The fields-level `DateCellRenderer`,
`dateCells.deadlineSettled-11815`, `dateCell.overdueZone-10183`,
`dateCell.unparsableValue-8581` and `date-locale-channel` suites stay
green unchanged, because a cell without `inGridColumn` keeps
`'relative'`.
- The detail, kanban, tree and list `deadlineSettled-11815` pins and
`HeaderHighlight.dateYear-13331` stay green unchanged.
## Verification (after merging `origin/main`, under the shared verify
lock)
The suites, type-checks and sdui record ran at `b5bc0328`. The head,
`aa24a3a2`, differs from it only in the changeset's prose. The derived
gates ran at `aa24a3a2`.
- **Suites.** `pnpm exec vitest run packages/fields
packages/plugin-grid` plus the eight cross-package date pins
(plugin-list, plugin-detail, plugin-kanban, plugin-tree), run with
`--maxWorkers=2`: Test Files 538 passed, 1 skipped (539); Tests 6566
passed, 7 skipped.
- **Type-checks.** `type-check` passes in `@object-ui/fields` (exit 0)
and in `@object-ui/plugin-grid` (exit 0).
- **sdui record.** `node scripts/gen-sdui-manifest-node.mjs` re-recorded
2 of 27 package records, `fields` and `plugin-grid`, and left
`sdui.manifest.json` unchanged. `node scripts/check-sdui-manifest.mjs`
exits 0.
- **Derived gates (at `aa24a3a2`).** `dispatch-gates --commands` derived
46 families; 45 ran with exit 0. `pnpm check:type-check-debt` exited 3
because the closure build it runs under the shared lock never got a
turn, so it is NOT-MEASURED here; CI runs it in Lint & Repo Gates.
`--ran` reconciles: 46 accounted, 0 UNRUN.
## Acceptance notes
- **RelatedList keeps the old default.** `plugin-detail`'s `RelatedList`
builds its own table cells, at `RelatedList.tsx` around line 1654, and
does not pass `inGridColumn`. Its `date` columns therefore still mix
faces. It is outside this claim's file surface and is left as is;
RelatedList is not addressed here.
- **One mobile-card case changes.** The grid's mobile card draws its
title slot and its non-date slots through the column `cell`. A grid
whose name or title column is a `date` field therefore reads absolute on
mobile too. The card's other date slots already used the absolute
`'short'` face.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01SMps7wq7rBTk53e8KTSEup)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent b7f8a2e commit 9c3097e
5 files changed
Lines changed: 292 additions & 24 deletions
File tree
- .changeset
- ui/packages
- fields/src
- plugin-grid/src
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
428 | 445 | | |
429 | 446 | | |
430 | 447 | | |
| |||
1144 | 1161 | | |
1145 | 1162 | | |
1146 | 1163 | | |
1147 | | - | |
| 1164 | + | |
1148 | 1165 | | |
1149 | 1166 | | |
1150 | 1167 | | |
| |||
1205 | 1222 | | |
1206 | 1223 | | |
1207 | 1224 | | |
1208 | | - | |
| 1225 | + | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
1209 | 1232 | | |
1210 | 1233 | | |
1211 | 1234 | | |
1212 | 1235 | | |
1213 | 1236 | | |
1214 | | - | |
| 1237 | + | |
| 1238 | + | |
1215 | 1239 | | |
1216 | 1240 | | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
1217 | 1249 | | |
1218 | 1250 | | |
1219 | 1251 | | |
1220 | | - | |
| 1252 | + | |
1221 | 1253 | | |
1222 | 1254 | | |
1223 | 1255 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
636 | 636 | | |
637 | 637 | | |
638 | 638 | | |
639 | | - | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
640 | 642 | | |
641 | 643 | | |
642 | 644 | | |
| |||
661 | 663 | | |
662 | 664 | | |
663 | 665 | | |
664 | | - | |
| 666 | + | |
665 | 667 | | |
666 | 668 | | |
667 | 669 | | |
| |||
2707 | 2709 | | |
2708 | 2710 | | |
2709 | 2711 | | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
2710 | 2718 | | |
2711 | 2719 | | |
2712 | 2720 | | |
| |||
3030 | 3038 | | |
3031 | 3039 | | |
3032 | 3040 | | |
3033 | | - | |
| 3041 | + | |
3034 | 3042 | | |
3035 | 3043 | | |
3036 | 3044 | | |
| |||
3048 | 3056 | | |
3049 | 3057 | | |
3050 | 3058 | | |
3051 | | - | |
| 3059 | + | |
3052 | 3060 | | |
3053 | 3061 | | |
3054 | 3062 | | |
| |||
3088 | 3096 | | |
3089 | 3097 | | |
3090 | 3098 | | |
3091 | | - | |
| 3099 | + | |
3092 | 3100 | | |
3093 | 3101 | | |
3094 | 3102 | | |
| |||
3269 | 3277 | | |
3270 | 3278 | | |
3271 | 3279 | | |
3272 | | - | |
| 3280 | + | |
3273 | 3281 | | |
3274 | 3282 | | |
3275 | 3283 | | |
| |||
3293 | 3301 | | |
3294 | 3302 | | |
3295 | 3303 | | |
3296 | | - | |
| 3304 | + | |
3297 | 3305 | | |
3298 | 3306 | | |
3299 | 3307 | | |
| |||
3458 | 3466 | | |
3459 | 3467 | | |
3460 | 3468 | | |
3461 | | - | |
| 3469 | + | |
3462 | 3470 | | |
3463 | 3471 | | |
3464 | 3472 | | |
| |||
3566 | 3574 | | |
3567 | 3575 | | |
3568 | 3576 | | |
3569 | | - | |
| 3577 | + | |
3570 | 3578 | | |
3571 | 3579 | | |
3572 | 3580 | | |
| |||
0 commit comments