Make profile formatting hydration-safe
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
import React from 'react'
|
||||
import { formatProfileDate } from '../../../lib/profileFormatters'
|
||||
import ProfileWorldRecognitionBadge from './ProfileWorldRecognitionBadge'
|
||||
|
||||
function formatDate(value) {
|
||||
if (!value) return null
|
||||
|
||||
try {
|
||||
const date = new Date(value)
|
||||
if (Number.isNaN(date.getTime())) return null
|
||||
|
||||
return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })
|
||||
return formatProfileDate(value, { month: 'short', day: 'numeric', year: 'numeric' })
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
@@ -119,4 +117,4 @@ export default function ProfileWorldHistoryCard({ entry }) {
|
||||
</div>
|
||||
</article>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user