tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
use localizeddate in post listing
awarm.space
3 months ago
7a30184a
0df627e0
+7
-7
1 changed file
expand all
collapse all
unified
split
components
PostListing.tsx
+7
-7
components/PostListing.tsx
···
13
13
14
14
import Link from "next/link";
15
15
import { InteractionPreview } from "./InteractionsPreview";
16
16
+
import { useLocalizedDate } from "src/hooks/useLocalizedDate";
16
17
17
18
export const PostListing = (props: Post) => {
18
19
let pubRecord = props.publication?.pubRecord as
···
123
124
};
124
125
125
126
const PostInfo = (props: { publishedAt: string | undefined }) => {
127
127
+
let localizedDate = useLocalizedDate(props.publishedAt || "", {
128
128
+
year: "numeric",
129
129
+
month: "short",
130
130
+
day: "numeric",
131
131
+
});
126
132
return (
127
133
<div className="flex gap-2 items-center shrink-0 self-start">
128
134
{props.publishedAt && (
129
135
<>
130
130
-
<div className="shrink-0">
131
131
-
{new Date(props.publishedAt).toLocaleDateString("en-US", {
132
132
-
year: "numeric",
133
133
-
month: "short",
134
134
-
day: "numeric",
135
135
-
})}
136
136
-
</div>
136
136
+
<div className="shrink-0">{localizedDate}</div>
137
137
</>
138
138
)}
139
139
</div>