Skip to content

formatNumber() and timeAgo() duplicated across 5+ files with inconsistencies #27

Description

@AditthyaSS

The following utility functions are copy-pasted across multiple files with slight inconsistencies:

formatNumber() — 5 copies:

RepoCard.jsx → uses lowercase k
RepoLayout.jsx → uses lowercase k
RepoOverviewPage.jsx → uses lowercase k
ComparePage.jsx → uses lowercase k, no M tier
ModelsPage.jsx → uses lowercase k
HomePage.jsx → uses uppercase K and M (different from all others)
timeAgo() — 3 copies:

RepoCard.jsx — returns Xmo ago
RepoIssuesPage.jsx — returns Xmo ago
RepoOverviewPage.jsx — includes today, yesterday, year support (different logic)
This creates inconsistent formatting across the app (e.g., "1.2K" on the homepage vs "1.2k" on repo cards).

Suggested fix: Extract to a shared src/utils/format.js module

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions