Skip to content

feat: add an opt-in compact absolute-time preset - #405

Open
tay1orjones wants to merge 5 commits into
mainfrom
copilot/add-opt-in-compact-absolute-time-preset
Open

tay1orjones wants to merge 5 commits into
mainfrom
copilot/add-opt-in-compact-absolute-time-preset

Conversation

@tay1orjones

@tay1orjones tay1orjones commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

<relative-time> can now show compact absolute timestamps in width-constrained layouts. The preset changes presentation, not how the element selects absolute, relative, or duration output.

  • API and precedence: Set absolute-format="compact" or element.absoluteFormat = 'compact'. The preset applies after the user preference, threshold, or format="datetime" selects absolute output. Omitted, empty, unknown, and removed values keep the existing presentation. Setting the property to undefined removes the attribute.
  • Rendering: Today in the effective display time zone uses a localized 12-hour time, such as today at 3:04 PM. Japanese and Chinese locale families, and patterns without a safe connector, join localized today and time with a space. Other days show a localized date with the year and no time, such as Nov 2, 2026. Display-field overrides affect compact text only; datetime, full and custom titles, and no-title are unchanged.
  • Rollover: The shared observer updates compact labels at calendar boundaries, including for recent timestamps, future dates across New Year, and daylight-saving transitions.
<relative-time datetime="2026-11-02T15:04:00Z" format="datetime" absolute-format="compact" lang="en-US">
  Nov 2, 2026
</relative-time>

Verification: Lint, build, all 693 Chromium tests, and a local install of the packed JavaScript, TypeScript declarations, and custom-element manifest passed.

Downstream handoff

PR #405 · Tested commit 2d5502b110c5ad2ce4e9af2668e43dd3a316c4bc

In the element checkout:

git fetch origin copilot/add-opt-in-compact-absolute-time-preset
git switch --detach 2d5502b110c5ad2ce4e9af2668e43dd3a316c4bc
npm ci
npm run build
npm pack --pack-destination /tmp

In the wrapper checkout:

npm install --no-save --package-lock=false /tmp/github-relative-time-element-0.0.0-development.tgz

The package contains JavaScript at dist/index.js and dist/bundle.js, declarations at dist/index.d.ts and dist/relative-time-element.d.ts, and metadata at custom-elements.json. No known blockers; no release or hosted tarball is needed.

Copilot AI linked an issue Nov 19, 2026 that may be closed by this pull request
15 tasks
tay1orjones and others added 2 commits November 19, 2026 19:10
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@tay1orjones tay1orjones changed the title [WIP] Add opt-in compact absolute-time preset feat: add an opt-in compact absolute-time preset Nov 19, 2026
@tay1orjones
tay1orjones requested a max review from Copilot November 19, 2026 19:46

This comment was marked as outdated.

@tay1orjones

Copy link
Copy Markdown
Contributor Author

@copilot address the outstanding review feedback

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@copilot address the outstanding review feedback

Addressed in 84ab6dc: past compact labels now schedule at calendar boundaries, including Casey rollbacks, and skip fine-grained updates. The full test suite passes (695 tests).

This comment was marked as outdated.

@tay1orjones

Copy link
Copy Markdown
Contributor Author

@copilot address the outstanding review feedback

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

Copilot AI commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

@copilot address the outstanding review feedback

Applied in adfbb14: initial compact timers are capped at one hour, and the long-delay test advances through hourly updates. npm test passes (695 tests).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human judgment is needed to assess the significance of unnecessary timer ticks that update every element in the shared observer while datetime text remains unchanged.

No open issues 🎉

1 resolved since last review

Review effort: Max

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an opt-in compact absolute-time preset

3 participants