Skip to content

[plugin-grid] ObjectGrid's record-detail date fallback renders the MACHINE locale #4541

Description

@yinlianghui

Found while implementing #4272's residue. Filed rather than fixed: #4272's ruling limited the plugin-grid surface to "ONLY the two date-cell call sites" (the two 'short' consumers in the mobile card view), and this is a third, separate site that was never among them.

The site

packages/plugin-grid/src/ObjectGrid.tsx, inside renderRecordDetail's type-inference fallback:

return (span className="text-sm tabular-nums")[formatDate(value)](/span);

(written without raw angle brackets — the real line is a span wrapping formatDate(value))

formatDate is called with no options, so its default branch hands Intl an undefined tag. undefined is not "the user's locale", it is the machine's — the exact mechanism #4468/#4272 were about. On a zh console this cell renders Aug 15, 2024 while every neighbouring date cell now renders 2024年8月15日.

Why it is a separate site, measured

The #4272 residue comment named the two consumers as ObjectGrid.tsx:2778,2795 at its time of writing. Relocating by content across the intervening churn, both of those are the two calls that pass 'short', and they moved by a constant -121 line offset (2899/2916 at #4531's parent). This site's offset does not fit that mapping, so it was never one of the two.

Scope of the fix

Small and self-contained: the component already reads const displayLocale = useDisplayLocale(); at component level after #4272's PR, so this is one call site gaining { locale: displayLocale }. It needs its own red-first case — a zh session asserting the Chinese form in the record-detail panel, which is a different render path from the mobile card view.

Sibling context: #4272 (the formatter residue, where this was found), #4468 / PR #4512 (the six renderer sites), #4513 (plugin-timeline).


Generated by Claude Code

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions