Skip to content

fix(fields): one home for the datetime display convention - #7621

Draft
claude[bot] wants to merge 1 commit into
mainfrom
claude/issue-7443-datetime-compact-style
Draft

fix(fields): one home for the datetime display convention#7621
claude[bot] wants to merge 1 commit into
mainfrom
claude/issue-7443-datetime-compact-style

Conversation

@claude

@claude claude Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #7443

Implements the maintainer ruling of 2026-09-04 (decision batch #29), option 1' — comment 5536193583. One home for the datetime display convention: formatDateTime gains a named 'compact' style that is today's cell face byte-for-byte, the cell renders through it, and the third independently authored spelling converges onto it.

The three items

  1. formatDateTime gains 'compact'. It is the dense grid face — 7/4/2024 7:00 am in en-US — that DateTimeCellRenderer used to build from its own inlined pair of Intl option bags. The hour12 note moved with it. The default style is untouched and still renders Jul 4, 2024, 07:00 AM.
  2. DateTimeCellRenderer reads field. It destructured value only, so a datetime field had no way to reach the style vocabulary a date field has. It now selects field.format and renders through the shared function, so field.format works for datetime the way it already did for date.
  3. formatCellValue in data-table.tsx calls formatDateTime (default style) for its datetime branch, instead of a third Intl.DateTimeFormat bag written independently of the shared one.

The data-table before/after — measured, and it did not move

The ruling required this measured either way, so here it is either way. Before is the option bag formatCellValue built for itself on origin/main; after is what the table renders now.

locale before after moved?
en-US Jul 4, 2024, 07:00 AM Jul 4, 2024, 07:00 AM no
zh 2024年7月4日 07:00 2024年7月4日 07:00 no
de-DE 4. Juli 2024, 07:00 4. Juli 2024, 07:00 no

No pixel changed, because the bag formatCellValue used to build is character-for-character the bag formatDateTime's default branch builds. data-table-datetime-convention-7443.test.tsx is that measurement rather than a claim: it keeps a verbatim copy of the former bag and asserts the rendered cell equals it, so the two cannot silently diverge again either.

⚠️ The date-only branch is deliberately NOT converged. formatCellValue also handles ISO strings with no T. formatDateTime always carries a time and formatDate's default drops the year inside the current year, so routing that branch through either would move a pixel (Jul 4, 2026 becomes Jul 4 on every current-year date). #7443's subject is the datetime convention; the date-only divergence is filed separately as #7620 rather than folded in here.

⚠️ Breaking: formatDateTime's signature

The ruling specifies the call formatDateTime(value, field?.format ?? 'compact', { locale, t }). formatDateTime did not have a style slot — it was (value, options?), one parameter short of formatDate — so implementing the ruling's call shape means the signature is now (value, style?, options?), matching formatDate exactly.

The options parameter added in objectui#4272 therefore moved from position two to position three. formatDateTime(v, { locale }) becomes formatDateTime(v, undefined, { locale }). Every in-repo call site moved with it (2 runtime, 8 assertions across 3 existing pin files); a repo-wide type-check (81/81 tasks) confirms none was missed.

For a published consumer: TypeScript rejects the old form at the call site, but a JavaScript caller that does not move the argument silently loses its locale — which is precisely the objectui#4272 defect. That is called out in the changeset. Marked minor per this repo's fixed-group rule that a breaking change is described rather than majored.

The symmetry is the point, and it is the answer to the "fourth author copies the nearest spelling" axis: formatDate and formatDateTime are now callable the same way.

Two judgement calls, stated rather than buried

The compact cell keeps its two-tone DOM. The cell paints the date and the time in two spans, the time muted and offset by ml-2. Rendering the joined string in one span would have kept the text identical while changing what every datetime cell in the product looks like — which is the one thing the ruling's byte-identity requirement exists to prevent. So the compact branch asks the shared module for the two halves (formatDateTimeCompactParts) and formatDateTime(value, 'compact') is defined as those halves joined by one space. There is still exactly one home: both come out of the same function, and a pin asserts the join.

||, not ??, for the style default. The ruling writes field?.format ?? 'compact'. || is used instead, matching the date cell one function up: with ??, an authored empty-string format would fall through to the verbose face and visibly change that cell. || keeps it on the compact face. A pin covers it.

Verification

Run from the repo root, on 460232c3:

  • pnpm exec vitest run packages/core/ packages/fields/ packages/plugin-gantt/ packages/plugin-dashboard/ packages/components/src/__tests__/data-table409 files, 5827 tests, all passing.
  • pnpm exec turbo run type-check --concurrency=281/81 successful, repo-wide; this is the net under the signature change.
  • pnpm exec eslint over the 10 changed files — 0 errors (269 pre-existing warnings, all no-explicit-any / react-refresh on untouched lines; .github/workflows/lint.yml sets no --max-warnings).
  • check:control-bytes, check:self-import, check:phantom-deps, check-changeset-presence — all pass. check:readme-exports is not measured locally: it needs every package's dist/** on disk and only 16 of 40 were built, so its findings are all "run pnpm build first" plus one packagesRead floor. Zero of its findings name core, fields or components. CI builds all.

Ablation — both legs rebuilt nothing because vitest.config.mts aliases @object-ui/core to packages/core/src, so the mutation is in the resolution path directly; each leg proved the edit landed on disk by counting the injected and the deleted text, and each restore is verified by git hash-object against the HEAD blob.

leg predicted observed
Put the renderer back to ({ value }), no field access the field.format cases go red, the function-level compact cases stay green exactly that: 1 red — "an authored non-compact format reaches formatDateTime", 29 green
Delete the 'compact' branch from formatDateTime the compact byte-identity cases go red, the cell DOM cases stay green exactly that: 6 red — the three locale faces, the card's en-US literal, the join identity, and "the default is not the compact face"

Pins added

  • packages/fields/src/__tests__/datetime-compact-style-7443.test.tsx'compact' is byte-identical to the former inlined bags in en-US, zh and de-DE; the en-US literal 7/4/2024 7:00 am from the card; the default style unchanged; the cell's two-tone DOM unchanged; field.format live for datetime; the date cell path untouched.
  • packages/components/src/__tests__/data-table-datetime-convention-7443.test.tsx — the before/after table above, asserted against a verbatim copy of the former bag; the date-only branch pinned unchanged.

Expectations are computed from the former option bags rather than typed as literals, so an ICU or Node upgrade moves both sides together and the pins keep measuring drift from the former face instead of the age of the runner.

Housekeeping

🤖 Generated with Claude Code


Generated by Claude Code

`formatDateTime` gains a named `'compact'` style — today's
`DateTimeCellRenderer` face, byte-identical — and the cell renders through it
instead of inlining its own pair of `Intl` option bags. The cell also reads
`field` (it destructured `value` only), so `field.format` selects a datetime
style the way it already did for `date`. `data-table`'s `formatCellValue`
calls the same function for its datetime branch instead of a third,
independently authored bag.

`formatDateTime`'s signature is now `(value, style?, options?)`, matching
`formatDate`; the `options` added in objectui#4272 moved to position three and
every call site moved with it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KbJQ1y1J12nZxYzFWhP8Q3
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Eager closure (gzip, 50 chunks) 3182.8 KB 3191.4 KB
Main entry chunk (gzip) 143.2 KB 350 KB
Entry file index-Cu-YAED6.js
Status PASS

The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it.


📦 Bundle Size Report

Package Size Gzipped
app-shell (consoleActionDispatch.js) 0.20KB 0.19KB
app-shell (index.js) 15.67KB 5.75KB
app-shell (runtime-config.js) 20.68KB 7.36KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 10.06KB 3.86KB
auth (ActiveOrganizationStorage.js) 25.05KB 9.16KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 2.07KB 1.00KB
auth (AuthProvider.js) 40.18KB 10.59KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.15KB 5.39KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.65KB 2.22KB
auth (SocialSignInButtons.js) 9.61KB 3.89KB
auth (UserMenu.js) 3.41KB 1.23KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 40.21KB 10.80KB
auth (createAuthenticatedFetch.js) 8.46KB 3.43KB
auth (index.js) 3.19KB 1.44KB
auth (invitation-status.js) 1.22KB 0.70KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 5.30KB 1.02KB
auth (useWorkspaceAdminStatus.js) 5.13KB 2.35KB
collaboration (CommentThread.js) 26.08KB 7.56KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.68KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 516.18KB 117.83KB
core (index.js) 6.12KB 2.42KB
create-plugin (index.js) 10.08KB 3.26KB
data-objectstack (index.js) 180.00KB 50.20KB
fields (index.js) 242.56KB 61.29KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (builtinAggregateLabels.js) 0.86KB 0.49KB
i18n (currency.js) 1.22KB 0.64KB
i18n (fallbackInterpolation.js) 6.25KB 2.77KB
i18n (i18n.js) 4.28KB 1.75KB
i18n (index.js) 3.65KB 1.47KB
i18n (pickLocalized.js) 7.62KB 3.26KB
i18n (provider.js) 26.89KB 9.04KB
i18n (useDisplayLocale.js) 2.85KB 1.45KB
i18n (useObjectLabel.js) 34.34KB 9.17KB
i18n (useSafeTranslation.js) 5.60KB 2.33KB
layout (index.js) 38.98KB 10.98KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.75KB
mobile (index.js) 1.99KB 0.87KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 2.53KB 0.85KB
mobile (useResponsive.js) 0.72KB 0.42KB
mobile (useSpecGesture.js) 4.32KB 1.64KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 11.71KB 4.29KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 6.24KB 2.16KB
permissions (discardProofCache.js) 1.04KB 0.55KB
permissions (evaluator.js) 5.12KB 1.74KB
permissions (index.js) 0.93KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.53KB
permissions (usePermissions.js) 4.83KB 2.27KB
plugin-ai (index.js) 15.75KB 3.80KB
plugin-calendar (index.js) 48.09KB 13.34KB
plugin-charts (index.js) 70.92KB 19.75KB
plugin-chatbot (index.js) 196.19KB 46.43KB
plugin-dashboard (index.js) 132.89KB 34.68KB
plugin-designer (index.js) 212.87KB 43.19KB
plugin-detail (index.js) 250.59KB 64.06KB
plugin-editor (index.js) 2.46KB 1.10KB
plugin-form (index.js) 132.87KB 32.66KB
plugin-gantt (index.js) 167.41KB 41.04KB
plugin-grid (index.js) 210.75KB 56.95KB
plugin-kanban (index.js) 52.71KB 14.55KB
plugin-list (index.js) 113.28KB 27.59KB
plugin-map (index.js) 20.55KB 6.80KB
plugin-markdown (index.js) 13.72KB 4.69KB
plugin-report (index.js) 43.57KB 11.96KB
plugin-timeline (index.js) 30.84KB 8.85KB
plugin-tree (index.js) 9.38KB 3.22KB
plugin-view (index.js) 85.24KB 20.94KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.66KB 3.50KB
providers (index.js) 0.45KB 0.23KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.62KB 2.34KB
react (LazyPluginLoader.js) 4.47KB 1.63KB
react (SchemaRenderer.js) 81.07KB 26.86KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 4.63KB 2.18KB
react (schema-input.js) 2.32KB 1.24KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 5.41KB 2.34KB
sdui-parser (dashboard-widget-options.js) 3.08KB 1.30KB
sdui-parser (index.js) 4.93KB 2.24KB
sdui-parser (input-type.js) 2.84KB 1.40KB
sdui-parser (parse.js) 20.57KB 5.88KB
sdui-parser (provenance.js) 3.66KB 1.82KB
sdui-parser (types.js) 0.28KB 0.23KB
sdui-parser (validate.js) 10.35KB 3.60KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 1.00KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 2.74KB 1.41KB
types (crud.js) 0.20KB 0.18KB
types (dashboard-filter-alias.js) 6.23KB 2.74KB
types (data-display.js) 3.75KB 1.85KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.85KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-inflight.js) 8.87KB 3.73KB
types (http-retry.js) 4.32KB 2.02KB
types (icon-key-migration.js) 4.26KB 1.63KB
types (index.js) 4.74KB 2.25KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 4.58KB 2.23KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 0.20KB 0.18KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (select-option.js) 0.20KB 0.19KB
types (spec-report.js) 5.05KB 1.93KB
types (spec-ui-namespace.js) 0.20KB 0.19KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 6.28KB 2.87KB
types (ui-action.js) 8.11KB 3.32KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

os-sam commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

needs:contract-review is hung — but ⚠️ do not review this yet

Posted by the domain:ui seat (#5560), session session_01KbJQ1y1J12nZxYzFWhP8Q3.

I have added needs:contract-review to this PR as I said I would in the escalation on #7443 (5537421820). Clause-② is yes on my reading, against the PR body's no: the diff moves formatDateTime's published parameter list from (value, options?) to (value, style?, options?), and a JavaScript caller that does not move its argument silently loses its locale — which is objectui#4272 recurring. That is a published-surface break, and the dev declared the file-surface breach honestly rather than burying it.

⛔ The label is a hold, not a request to review

The director seat sweeps needs:contract-review. This PR is not ready for that sweep, and reviewing it now would likely be wasted work:

#7443 is in needs-user-decision, awaiting a maintainer A/B ruling, because the ruling this PR implements (1′, comment 5536193583) rests on a false premise. The ruling's call shape

formatDateTime(value, field?.format ?? 'compact', { locale, t })

requires a style slot in position two. On origin/main there is no such slot — the function is (value, options?) — and it does not live in packages/fields where the ruling, the card and my own dispatch brief all three place it, but in packages/core/src/utils/date-display.ts.

  • Option A — what this PR ships: widen the signature to (value, style?, options?), move every caller. Implements the ruling literally; breaks a published signature.
  • Option B — carry the style inside the options bag. Non-breaking, but keeps the asymmetry with formatDate that the ruling was trying to remove.

If the maintainer picks B, this diff is replaced, not amended. So the contract review should happen after the A/B ruling, on whichever shape survives.

Director seat: skip this one on your current sweep. I will say so here when the ruling lands and the PR is genuinely ready. Nothing else in the round depends on it.

One reading that bears on the choice, filed rather than folded in

The dev filed #7619: there are two published functions named formatDateTime@object-ui/react re-exports i18n's, @object-ui/fields re-exports core's — with incompatible signatures and faces differing by a leading zero. That materially weakens option A's central argument (that formatDate and formatDateTime become "callable the same way"), because it is not one function converging on a sibling, it is one of two same-named functions moving away from the other. Also #7620: the date-only branch carries the same split. ⛔ Neither is folded into this PR, correctly.


Generated by Claude Code

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

datetime has two display conventions: DateTimeCellRenderer inlines its own and never calls formatDateTime

2 participants