Skip to content

Commit

Permalink
Update timer
Browse files Browse the repository at this point in the history
  • Loading branch information
iancheung0202 authored Nov 22, 2024
1 parent b3abe95 commit 35b7041
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/app/(landing)/Heading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ const msToTime = (time: number) => {
time = Math.floor(time / 60); // Convert to hours
const hours = time % 24;
const days = Math.floor(time / 24); // Convert to days
return `${days} days, ${hours} hours, ${min} minutes, and ${sec} seconds`;

const parts = [];
if (days > 0) parts.push(`${days} day${days > 1 ? 's' : ''}`);
if (hours > 0) parts.push(`${hours} hour${hours > 1 ? 's' : ''}`);
if (min > 0) parts.push(`${min} minute${min > 1 ? 's' : ''}`);
if (sec > 0) parts.push(`${sec} second${sec > 1 ? 's' : ''}`);

return parts.join(', ');
};

export default function Heading() {
Expand Down

1 comment on commit 35b7041

@github-actions
Copy link

Choose a reason for hiding this comment

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

Deploy preview for gunnhacks11-0 ready!

✅ Preview
https://gunnhacks11-0-6hfx421x6-daniel-kous-projects.vercel.app

Built with commit 35b7041.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.