a tool for shared writing and social publishing

use localizeddate in post listing

+7 -7
+7 -7
components/PostListing.tsx
··· 13 13 14 14 import Link from "next/link"; 15 15 import { InteractionPreview } from "./InteractionsPreview"; 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 + let localizedDate = useLocalizedDate(props.publishedAt || "", { 128 + year: "numeric", 129 + month: "short", 130 + day: "numeric", 131 + }); 126 132 return ( 127 133 <div className="flex gap-2 items-center shrink-0 self-start"> 128 134 {props.publishedAt && ( 129 135 <> 130 - <div className="shrink-0"> 131 - {new Date(props.publishedAt).toLocaleDateString("en-US", { 132 - year: "numeric", 133 - month: "short", 134 - day: "numeric", 135 - })} 136 - </div> 136 + <div className="shrink-0">{localizedDate}</div> 137 137 </> 138 138 )} 139 139 </div>