Skip to content

Commit

Permalink
Fix timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
Hacksore committed Aug 19, 2024
1 parent 829b9d8 commit 70d4e56
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions apps/web/src/components/react/download.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Download = ({ canary = true }: { canary?: boolean }) => {
const [platformDownloads, setPlatformDownloads] = useState<{
downloads: PlatformDownload[];
latestVersion: string;
updated?: string;
updatedAt?: string;
}>({
downloads: [],
latestVersion: "",
Expand All @@ -38,14 +38,16 @@ export const Download = ({ canary = true }: { canary?: boolean }) => {
useEffect(() => {
const timerId = setInterval(() => {
setFormattedTime(
getRelativeTime(platformDownloads.updated || new Date()),
getRelativeTime(platformDownloads.updatedAt || new Date()),
);
}, 1000);

setFormattedTime(getRelativeTime(platformDownloads.updated || new Date()));
setFormattedTime(
getRelativeTime(platformDownloads.updatedAt || new Date()),
);

return () => clearInterval(timerId);
}, [platformDownloads.updated]);
}, [platformDownloads.updatedAt]);

const commitSha = platformDownloads.latestVersion.substring(0, 7);
const shortCommitSha = commitSha.substring(0, 7);
Expand Down

0 comments on commit 70d4e56

Please sign in to comment.