Make profile formatting hydration-safe
This commit is contained in:
@@ -1,17 +1,11 @@
|
||||
import React from 'react'
|
||||
import { formatProfileDate, formatProfileNumber } from '../../../lib/profileFormatters'
|
||||
|
||||
function formatFollowedAt(value) {
|
||||
if (!value) return null
|
||||
|
||||
try {
|
||||
const date = new Date(value)
|
||||
if (Number.isNaN(date.getTime())) return null
|
||||
|
||||
return date.toLocaleDateString(undefined, {
|
||||
year: 'numeric',
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
})
|
||||
return formatProfileDate(value, { year: 'numeric', month: 'short', day: 'numeric' })
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
@@ -36,7 +30,7 @@ export default function TabFollowers({ listing, username, followerCount }) {
|
||||
<i className="fa-solid fa-users text-sky-400 fa-fw" />
|
||||
Followers
|
||||
<span className="rounded bg-white/5 px-1.5 py-0.5 text-[10px] font-medium normal-case tracking-normal text-slate-400">
|
||||
{total.toLocaleString()}
|
||||
{formatProfileNumber(total)}
|
||||
</span>
|
||||
</h2>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user