iiitl / iiitl/Opensource_Compass
Show Full Date for "Last Checked" in the Profile Watchlist
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
In the **Profile page → Watched Repositories** section, each watched repo shows a "Last checked" timestamp. Currently, it is rendered using `.toLocaleTimeString()` which only shows the time — for example: `"3:45:02 PM"`.
If a repo was last checked yesterday, 3 days ago, or last week, the user sees no date context at all — just a meaningless time like `"11:30:00 AM"`. This is confusing and unhelpful.
---
### 📍 File to Change
`frontend/app/(auth)/profile/page.tsx` — inside the `Watchlist` sub-component (around line 271)
---
### 🔍 Current Code (line ~271)
```tsx
Last checked: {repo.last_checked_at
? new Date(repo.last_checked_at).toLocaleTimeString() // ← PROBLEM: no date!
: 'Never'}
```
---
### ✅ What To Do
**Option A (Recommended) — Relative time** (e.g., `"2 hours ago"`, `"3 days ago"`):
Add a `formatTimeAgo` helper (already exists in `notifications/page.tsx` — you can copy it into `frontend/lib/utils.ts` to share it):
```ts
// In frontend/lib/utils.ts
export function formatTimeAgo(date: Date): string {
const seconds = Math.floor((new Date().getTime() - date.getTime()) / 1000);
if (seconds < 60) return `${seconds}s ago`;
const minutes = Math.floor(seconds / 60);
if (minutes < 60) return `${minutes}m ago`;
const hours = Math.floor(minutes / 60);
if (hours < 24) return `${hours}h ago`;
const days = Math.floor(hours / 24);
return `${days}d ago`;
}
```
Then use it:
```tsx
Last checked: {repo.last_checked_at
? formatTimeAgo(new Date(repo.last_checked_at))
: 'Never'}
```
**Option B — Full locale string:**
```tsx
Last checked: {repo.last_checked_at
? new Date(repo.last_checked_at).toLocaleString() // Shows date + time
: 'Never'}
```
Either option is acceptable — relative time (Option A) is preferred.
---
### 🏁 Acceptance Criteria
- [ ] "Last checked" in the Watchlist section of the Profile page shows date context (relative or full date+time)
- [ ] If `last_checked_at` is `null`, it still shows `"Never"`
- [ ] The change is inside the `Watchlist` component in `profile/page.tsx`
- [ ] (Bonus) The `formatTimeAgo` helper is extracted to `frontend/lib/utils.ts` and imported in both `profile/page.tsx` and `notifications/page.tsx`
---
### 💡 Technical Hints
- The bug is at line ~271 in `frontend/app/(auth)/profile/page.tsx` — find `.toLocaleTimeString()` and replace it
- The `formatTimeAgo` function already exists in `frontend/app/(auth)/notifications/page.tsx` — no need to write it from scratch, just move it to a shared utility
---
### 🚀 Getting Started
1. Fork the repository
2. Create a branch: `git checkout -b fix/issue-6-watchlist-date-format`
3. Edit `frontend/app/(auth)/profile/page.tsx`
4. Optionally, extract `formatTimeAgo` to `frontend/lib/utils.ts`
5. Run locally: `cd frontend && npm run dev` → navigate to `/profile`
6. Open a Pull Request!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in frontend/app/(auth)/profile/page.tsx, inside the Watchlist component, and inspect the .toLocaleTimeString() call. Compare the existing formatTimeAgo helper in frontend/app/(auth)/notifications/page.tsx, then run cd frontend && npm run dev and visit /profile. Done means Last checked includes date context while null values still display “Never”.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100