GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: last activity timestamp shows incorrectly for all projects by uddhav05-cyber · Pull Request #482 · github/forgoodfirstissue

Conversation

@uddhav05-cyber

@uddhav05-cyber uddhav05-cyber commented May 16, 2026

Copy link
Copy Markdown

Fixes #440

Problem

dayjs.extend(relativeTime) was being called inside the component on every render, causing all repositories to display an incorrect/stale relative timestamp.

Fix

  • Extracted useLastModified into a proper custom hook in hooks/useLastModified.tsx
  • dayjs.extend(relativeTime) now runs once at module scope
  • RepositoryItem.tsx imports and uses the new hook cleanly

Changes

  • hooks/useLastModified.tsx — new custom hook
  • components/RepositoryItem.tsx — removed inline dayjs.extend, uses new hook

Note: PR #442 addressed the same issue but has been unreviewed for several months.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
uddhav bhople
fix: move dayjs.extend to module scope for correct last_modified display
9912938
Copilot AI review requested due to automatic review settings May 16, 2026 19:17
Copilot AI reviewed May 16, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes incorrect/stale “Last Activity” relative timestamps by moving dayjs.extend(relativeTime) out of the RepositoryItem component and extracting the logic into a reusable useLastModified hook.

Changes:

  • Added hooks/useLastModified.tsx custom hook and initialized dayjs relative-time plugin at module scope.
  • Updated components/RepositoryItem.tsx to consume useLastModified and removed inline dayjs/hook logic.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
hooks/useLastModified.tsx New hook for computing “last modified” relative time; initializes dayjs plugin once.
components/RepositoryItem.tsx Uses the new hook instead of defining it inline; removes repeated dayjs.extend.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread hooks/useLastModified.tsx Outdated
Comment on lines +3 to +16
import { useEffect, useState } from "react";

// Extend dayjs with relativeTime plugin at module scope
dayjs.extend(relativeTime);

export const useLastModified = (date: string) => {
const [lastModified, setLastModified] = useState("");

useEffect(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
setLastModified(dayjs(date).fromNow());
}, [date]);

return lastModified;
Comment thread components/RepositoryItem.tsx
Comment on lines 20 to +29
useEffect(() => {
if (isIssueOpen) {
// eslint-disable-next-line react-hooks/set-state-in-effect
setIsIssuesListVisible(true);
} else {
// Delay unmounting to allow close animation to complete
const timer = setTimeout(() => setIsIssuesListVisible(false), 300);
const timer = setTimeout(() => {
// eslint-disable-next-line react-hooks/set-state-in-effect
setIsIssuesListVisible(false);
}, 300);
uddhav bhople added 2 commits May 17, 2026 00:58
uddhav bhople
fix: simplify useLastModified and remove invalid eslint-disable comments
01bda00
uddhav bhople
fix: remove invalid eslint-disable comment in RepositoryItem
b207e83

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

At least 1 approving review is required to merge this pull request.

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Bug: last activity shows as "2 years ago" for all projects

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@uddhav05-cyber
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.