function toMysqlDate(value) { if (!value) return null const d = new Date(value) if (Number.isNaN(d.getTime())) return null return d.toISOString().slice(0, 19).replace('T', ' ') } function formatDate(date) { return toMysqlDate(date) } module.exports = { toMysqlDate, formatDate }