Skip to content

Commit a688648

Browse files
committed
docs(plugin-dashboard): cite the spec format description by the change that wrote it
The FieldSchema.format wording the comments lean on landed in objectstack#19763; the spec version this repo builds against still carries the older one-line description, so the comments now name the change rather than claim the installed package says it. Also give the inline comment's "those letters" its antecedent. Claude-Session: https://claude.ai/code/session_01BP8CMtACxTdLjqR6rhd33C Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7e2f7c0 commit a688648

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

‎packages/plugin-dashboard/src/__tests__/recordFields.formatHintNotDatePattern-10220.test.tsx‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535
*
3636
* A hint-word exclusion list would be a second copy of the resolver's
3737
* vocabulary, kept in step by hand — and the autonumber case above shows it
38-
* would still be incomplete. `@objectstack/spec` already describes `format` as
39-
* type-dependent (`FieldSchema.format`: the `date` and `datetime` cells read it
40-
* as a display style; plain-text fields read a small set of renderer-hint
41-
* words). So the branch now asks the question that description asks: is this
42-
* a `date` / `datetime` field? A field whose type is unknown is not a date
38+
* would still be incomplete. The `FieldSchema.format` description
39+
* objectstack#19763 wrote for `@objectstack/spec` already treats `format` as
40+
* type-dependent: the `date` and `datetime` cells read it as a display style,
41+
* and plain-text fields read a small set of renderer-hint words. So the branch
42+
* now asks the question that description asks: is this a `date` / `datetime`
43+
* field? A field whose type is unknown is not a date
4344
* cell either — a column with no schema type declares one (`type: 'date'`) to
4445
* get the date face, which the last case below pins.
4546
*

‎packages/plugin-dashboard/src/recordFields.tsx‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ export const NUMERIC_FIELD_TYPES = new Set([
6969
* Field types whose `format` {@link renderFieldValue} reads as a date display
7070
* pattern (objectui#10220).
7171
*
72-
* `format` has one key and several readers, each with its own vocabulary —
73-
* `@objectstack/spec` says so in `FieldSchema.format`'s own description: the
74-
* `date` / `datetime` cells read it as a display style, while on a plain-text
75-
* field the shared resolver (`resolveCellRendererType`, `@object-ui/fields`)
76-
* reads a small set of renderer-hint words. The date branch used to fire on any
72+
* `format` has one key and several readers, each with its own vocabulary. The
73+
* `FieldSchema.format` description objectstack#19763 wrote for
74+
* `@objectstack/spec` says so: the `date` / `datetime` cells read it as a
75+
* display style, while on a plain-text field the shared resolver
76+
* (`resolveCellRendererType`, `@object-ui/fields`) reads a small set of
77+
* renderer-hint words. The date branch used to fire on any
7778
* `format` containing a Y / M / D / H / m / s letter, whatever the field's type,
7879
* so `format: 'email'` (it has an `m`) sent an address to `formatDate` and
7980
* painted an em dash. So did an `autonumber` record-number pattern carrying
@@ -451,8 +452,8 @@ export function renderFieldValue(
451452
}
452453
// A date pattern only on a date field (objectui#10220) — see
453454
// `DATE_PATTERN_FIELD_TYPES` for why the gate is the type. A date field's
454-
// style word with none of those letters (`relative`) still falls through to
455-
// its cell renderer below, as before.
455+
// style word that carries none of the Y / M / D / H / m / s letters
456+
// (`relative`) still falls through to its cell renderer below, as before.
456457
if (
457458
typeof fmt === 'string'
458459
&& DATE_PATTERN_FIELD_TYPES.has(fieldMeta.type as string)

0 commit comments

Comments
 (0)