Repository navigation
Conversation
relativeTime picked the unit from the unrounded elapsed time and then rounded, so 59.7 seconds ago read "60 seconds ago", 59m45s "60 minutes ago", 23h45m "24 hours ago" and 6d13h "7 days ago". Pick the unit after rounding instead. relativeTime takes an optional `now`, like relativeTimeShort, so it can be tested.
kevin9327
requested review from
MikeRyanDev,
davidmckayv,
dustywusty,
guidovizoso,
mxmzb,
samjulien and
tylerslaton
as code owners
November 4, 2026 23:17
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
relativeTimeinapp/src/lib/relative-time.ts(the "2 minutes ago" text on tasks, routines, approvals, suggestions, the activity feed and a few settings pages) chose its unit from the unrounded elapsed time and then rounded the count. A time just under a unit's bound therefore rounded up to the bound and showed it:The unit is now chosen after rounding: for each unit in turn the count is rounded, and the first unit whose rounded count stays under its bound is used. Times well inside a unit, future times, and invalid dates read as before.
relativeTimeShortalready floors for the same reason and is unchanged.relativeTimetakes an optionalnow: Date = new Date(), the same asrelativeTimeShort, so the test can pin the clock. Existing callers pass only the ISO string and are unaffected.Where it runs
Boundary and audit
Changelog
CHANGELOG.mdunderUnreleased; happy to rebase if it conflicts.Proof
New
app/tests/relative-time.test.ts. Its cases compare againstIntl.RelativeTimeFormatwith the same options, so they don't depend on the test machine's locale. The unmodified function, with the clock pinned throughsetSystemTime(it had nonowparameter), returns60 seconds ago,60 minutes ago,24 hours agoand7 days agofor the four rows above. With the change,bun test tests/relative-time.test.ts tests/relative-time-short.test.tspasses (9 pass).biome checkon the changed files is clean. I did not runtscor the rest of the app suite.AI assistance: I used an AI coding assistant (Grok Bot) to find and write this change, and ran the tests above.