Skip to content

fix(web): show 1y ago instead of 0y ago for year-old comments - #3564

Open
AryaKesharwani wants to merge 1 commit into
CapSoftware:mainfrom
AryaKesharwani:fix/time-ago-zero-years
Open

AryaKesharwani wants to merge 1 commit into
CapSoftware:mainfrom
AryaKesharwani:fix/time-ago-zero-years

Conversation

@AryaKesharwani

@AryaKesharwani AryaKesharwani commented Oct 29, 2026 •

Copy link
Copy Markdown

Comments and share pages aged 360–364 days showed "0y ago". formatTimeAgo switches to years after twelve 30-day months (360 days), but divides by 365, so the year count was still 0.

Clamp the year count to at least 1 once the months branch is exhausted. Everything below 360 days and from 365 days on is unchanged.

Age Before After
359 days 11mo ago 11mo ago
360 / 362 / 364 days 0y ago 1y ago
365 days 1y ago 1y ago
730 days 2y ago 2y ago

Validation: new activity-time-ago.test.ts (3 tests, fake clock) passes; the 360–364 day case fails on baseline. Verified in a local self-hosted web build: a seeded 362-day-old comment showed 0y ago in the share page Comments tab before the change and 1y ago after. Biome check passes on both touched files.

Closes #3562.

RetriggerView in GreptileConfidence Score: 5/5

This PR appears safe to merge.

Summary

Fixes formatTimeAgo so dates aged 360–364 days show 1y ago instead of 0y ago.

  • Comment ages show at least one year after twelve months.

Reviews (1) · Last reviewed commit: "fix(web): show 1y ago instead of 0y ago ..." · Reviewed by Greptile

@vercel
vercel Bot temporarily deployed to Preview – cap-status October 29, 2026 20:54 Inactive
@vercel

vercel Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
cap-status Skipped Skipped Oct 29, 2026 8:54pm UTC

This branch was previously deployed

1 inactive deployment
Preview – cap-status — 7ad117d7 Deployed Oct 29, 2026 by vercel[bot]
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.

Comments show "0y ago" when they are 360–364 days old

1 participant