Skip to content

finding(core): formatRelativeDate still ignores options.style, and its out-of-window ABSOLUTE fallback is the one place the key is already well-defined #7816

Description

@claude

Reported by the #7745 dev seat as its first open question, and filed here by the PM seat so it survives that card's Fixes close. ⛔ Deliberately not done inside #7745: the maintainer ruling there names formatDate only.

The state after objectui#7745 (PR #7813)

formatDate now reads options.style (style ?? options?.style, positional wins). formatRelativeDate reads nothing — and it is not genuinely style-less, because it delegates to formatDate outside its ±7-day window. So today an out-of-window date renders the default absolute face no matter what the shared options bag says.

⚠️ That delegation is currently guarded on purpose: #7745 added a module-local, non-exported absoluteFallbackOptions that strips style before the out-of-window call. That guard is behaviour-preserving, not a feature — it exists because the new read would otherwise have changed formatRelativeDate's output as a side effect of a card that was not about it.

The three options, as the #7745 seat framed them

shape cost
A no read at all — keep formatRelativeDate style-less, as today nothing changes; the shared bag stays half-honoured
B ⬅ recommended read it only for the out-of-window ABSOLUTE fallback: formatRelativeDate(v, { style: 'short' }) on a two-year-old date renders Jul 4, '24 instead of Jul 4, 2024 well-defined today, zero new vocabulary
C read it for the relative phrase itself ⛔ requires minting a relative-style vocabulary that does not exist — the key would be accepted with nothing to name

⭐ The measurement is already done — this card starts with its own before/after

#7745's ablation leg C dropped the strip and is therefore exactly the measurement of what flipping this costs. It turned three cases red (one more than predicted, reported as observed):

AssertionError: expected 'Jul 4, '24' to be 'Jul 4, 2024'      ← the leak into formatRelativeDate
RangeError: Maximum call stack size exceeded                    ← { style: 'relative' } recurses

⇒ Two things this pins for whoever takes it:

  1. The change is one line — flipping the absoluteFallbackOptions strip that finding(core): DateDisplayOptions.style is read by formatDateTime alone — on formatDate it is inert AND collides with a positional parameter of the same name #7745 added.
  2. ⛔ It is not a one-line change in consequence: { style: 'relative' } handed to formatRelativeDate recurses to stack exhaustion through the delegation. Any implementation of B must answer that input explicitly. The trap is already measured; do not rediscover it in production.

What makes this a real decision and not a freebie

  • It makes the ±7-day boundary a visible face boundary: In 2 days inside the window, Jul 4, '24 outside — two different faces from one call, selected by the date rather than by the author.
  • It changes live grid / gantt output for any caller already threading one shared options bag through both functions.

⇒ Which is precisely why #7745 refused to do it unasked, and why this is a card.

Related: objectui#7745 (the ruling and the formatDate read) · PR objectui#7813 · objectui#4272 (the silent-override incident the module header records)


Generated by Claude Code

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

    Labels

    domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatfindingpackage: corepriority:p3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions