Make profile formatting hydration-safe

This commit is contained in:
test
2026-08-30 09:28:07 +02:00
parent 5db36cb29f
commit 71972afb87
9 changed files with 44 additions and 60 deletions
@@ -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>
)
}
}
@@ -1,4 +1,5 @@
import React from 'react'
import { formatProfileDate } from '../../../lib/profileFormatters'
import ProfileWorldStatsRow from './ProfileWorldStatsRow'
import ProfileWorldRecognitionBadge from './ProfileWorldRecognitionBadge'
@@ -6,10 +7,7 @@ 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
}
@@ -51,4 +49,4 @@ export default function ProfileWorldHistorySummary({ history }) {
) : null}
</div>
)
}
}