Add admin and customer interfaces, orders, signed activation and leases, protected package delivery, keyring verification, migrations, security controls, tests and deployment documentation. Co-Authored-By: Craft Agent <agents-noreply@craft.do>
17 lines
482 B
TypeScript
17 lines
482 B
TypeScript
const formatter = new Intl.DateTimeFormat('zh-CN', {
|
|
year: 'numeric',
|
|
month: '2-digit',
|
|
day: '2-digit',
|
|
hour: '2-digit',
|
|
minute: '2-digit',
|
|
second: '2-digit',
|
|
hour12: false,
|
|
})
|
|
|
|
export function formatDateTime(value: string | Date | null | undefined, empty = '—'): string {
|
|
if (!value) return empty
|
|
const date = value instanceof Date ? value : new Date(value)
|
|
if (Number.isNaN(date.getTime())) return empty
|
|
return formatter.format(date).replace(/\//g, '-')
|
|
}
|