mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-06 06:41:56 +00:00
* feat(web): make session header metadata configurable * fix(web): align mobile header metadata priority
14 lines
429 B
TypeScript
14 lines
429 B
TypeScript
export function formatSessionHeaderTimestamp(value: number, locale?: string): string | null {
|
|
if (!Number.isFinite(value) || value <= 0) return null
|
|
const date = new Date(value)
|
|
if (Number.isNaN(date.getTime())) return null
|
|
|
|
return new Intl.DateTimeFormat(locale, {
|
|
year: 'numeric',
|
|
month: 'short',
|
|
day: 'numeric',
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
}).format(date)
|
|
}
|