Skip to content

Commit

Permalink
Merge pull request hashirshoaeb#56 from ajmeese7/new-features
Browse files Browse the repository at this point in the history
Accurate update times
  • Loading branch information
hashirshoaeb authored Oct 2, 2020
2 parents 512b1ab + b00f883 commit 35de6b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/home/ProjectCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ const CardFooter = ({ star_count, repo_url, pushed_at }) => {
const hours = Math.trunc(diff / 1000 / 60 / 60);

if (hours < 24) {
return setUpdated_at(`${hours.toString()} hours ago`);
if (hours < 1) return setUpdatedAt("just now");
let measurement = hours === 1 ? "hour" : "hours";
return setUpdatedAt(`${hours.toString()} ${measurement} ago`);
} else {
const options = { day: "numeric", month: "long", year: "numeric" };
const time = new Intl.DateTimeFormat("en-US", options).format(date);
Expand Down

0 comments on commit 35de6b8

Please sign in to comment.