Repository navigation
fix(web): show 1y ago instead of 0y ago for year-old comments - #3564
Open
AryaKesharwani wants to merge 1 commit into
Open
AryaKesharwani wants to merge 1 commit into
AryaKesharwani wants to merge 1 commit into
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously 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.
Comments and share pages aged 360–364 days showed "0y ago".
formatTimeAgoswitches 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.
11mo ago11mo ago0y ago1y ago1y ago1y ago2y ago2y agoValidation: 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 showed0y agoin the share page Comments tab before the change and1y agoafter. Biome check passes on both touched files.Closes #3562.


Confidence Score: 5/5
This PR appears safe to merge.Summary
Fixes
formatTimeAgoso dates aged 360–364 days show1y agoinstead of0y ago.Reviews (1) · Last reviewed commit: "fix(web): show 1y ago instead of 0y ago ..." · Reviewed by Greptile