1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-21 05:21:17 -04:00

use <time> element for all dates

This commit is contained in:
2022-04-16 15:59:28 -04:00
parent 1648464e0e
commit fa968dbcd2
11 changed files with 217 additions and 202 deletions

View File

@@ -1,7 +1,6 @@
import Link from "../Link";
import RelativeTime from "../RelativeTime";
import { StarOcticon, ForkOcticon } from "../Icons";
import { useHasMounted } from "../../hooks/use-has-mounted";
import { formatDateTZ, formatTimeAgo } from "../../lib/helpers/format-date";
import { styled } from "../../lib/styles/stitches.config";
import { siteLocale } from "../../lib/config";
import type { RepositoryType } from "../../types";
@@ -83,8 +82,6 @@ const RepositoryCard = ({
updatedAt,
className,
}: RepositoryCardProps) => {
const hasMounted = useHasMounted();
return (
<Wrapper className={className}>
<Name href={url}>{name}</Name>
@@ -128,8 +125,8 @@ const RepositoryCard = ({
)}
{/* only use relative "time ago" on client side, since it'll be outdated via SSG and cause hydration errors */}
<MetaItem title={formatDateTZ(updatedAt)}>
<span>Updated {hasMounted ? formatTimeAgo(updatedAt) : `on ${formatDateTZ(updatedAt, "PP")}`}</span>
<MetaItem>
<RelativeTime date={updatedAt} />
</MetaItem>
</Meta>
</Wrapper>