18 lines
441 B
JavaScript
18 lines
441 B
JavaScript
export function parseSqliteDateTime(value) {
|
|
if (!value) return null
|
|
if (value instanceof Date) return value
|
|
|
|
const str = String(value)
|
|
// "YYYY-MM-DD HH:mm:ss" -> "YYYY-MM-DDTHH:mm:ss"
|
|
const iso = str.includes('T') ? str : str.replace(' ', 'T')
|
|
const date = new Date(iso)
|
|
if (Number.isNaN(date.getTime())) return null
|
|
return date
|
|
}
|
|
|
|
export function formatDateTime(value) {
|
|
if (!value) return '-'
|
|
return String(value)
|
|
}
|
|
|