Skip to content

Add micro tense phrasing - #358

Merged
liuliu-dev merged 2 commits into
mainfrom
liuliu/micro-tense-phrasing
Jun 9, 2026
Merged

Add micro tense phrasing#358
liuliu-dev merged 2 commits into
mainfrom
liuliu/micro-tense-phrasing

Conversation

@liuliu-dev

Copy link
Copy Markdown
Contributor

Re-opens #355 against main. The original PR was merged into the mb/micro-explicit-threshold feature branch instead of main, so the changes never landed in 5.1.0.

maxbeizerand others added 2 commits June 9, 2026 16:47
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CopilotAI review requested due to automatic review settings June 9, 2026 17:17
@liuliu-dev
liuliu-dev requested a review from a team as a code ownerJune 9, 2026 17:17
GitHub Advanced Securitystarted work on behalf of liuliu-devJune 9, 2026 17:17View session
GitHub Advanced Securityfinished work on behalf of liuliu-devJune 9, 2026 17:18

CopilotAI 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.

Pull request overview

This PR reintroduces the previously merged “micro tense phrasing” work onto main, making format="micro" produce localized tense-aware output when tense is explicitly set to past or future (while keeping the existing compact output for tense="auto").

Changes:

  • Add Intl.RelativeTimeFormat-backed narrow tense phrasing for format="micro" when tense is past/future.
  • Refactor micro-duration handling into a dedicated helper (#getMicroDuration) and add a micro-specific relative formatter (#getMicroRelativeFormat).
  • Update/extend tests and README documentation to reflect the new micro tense behavior and ensure datetime/absolute-time fallbacks do not add tense text.
Show a summary per file
FileDescription
test/relative-time.jsAdds and updates assertions for micro tense phrasing, including fallback behaviors.
src/relative-time-element.tsImplements micro tense phrasing via Intl.RelativeTimeFormat and refactors micro duration handling.
README.mdDocuments micro tense phrasing behavior and updates the tense cheatsheet/table.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Comment threadsrc/relative-time-element.ts
Comment threadREADME.md
Comment threadtest/relative-time.js
Comment on lines +531 to +540
test('micro tense phrasing respects lang attribute', async () => {
const now = new Date(Date.now() + 3 * 60 * 60 * 24 * 1000).toISOString()
const time = document.createElement('relative-time')
time.setAttribute('datetime', now)
time.setAttribute('format', 'micro')
time.setAttribute('lang', 'es')
time.setAttribute('tense', 'future')
await Promise.resolve()
assert.equal(time.shadowRoot.textContent, 'dentro de 3 d')
})
@liuliu-dev
liuliu-dev merged commit a41437e into mainJun 9, 2026
6 checks passed
@liuliu-dev
liuliu-dev deleted the liuliu/micro-tense-phrasing branch June 9, 2026 18:21
Sign up for freeto 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.

4 participants

@liuliu-dev@TylerJDev@maxbeizer