Files
yhy-mager/frontend/src/date-format.ts
xiewenjun 54c318c615
Some checks failed
Check / delivery-static (push) Has been cancelled
Check / api (push) Has been cancelled
Check / web (push) Has been cancelled
feat: implement license platform business flows and delivery tooling
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>
2026-10-09 15:33:22 +08:00

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, '-')
}