// 订单时间展示格式化:今天显示 HH:mm,昨天显示“昨天 HH:mm”,更早显示 MM-DD HH:mm export function formatOrderTime(iso) { if (!iso) return '' const d = new Date(iso) if (isNaN(d.getTime())) return '' const now = new Date() const p = (n) => String(n).padStart(2, '0') const hm = `${p(d.getHours())}:${p(d.getMinutes())}` if (d.toDateString() === now.toDateString()) return hm const y = new Date(now) y.setDate(now.getDate() - 1) if (d.toDateString() === y.toDateString()) return '昨天 ' + hm return `${p(d.getMonth() + 1)}-${p(d.getDate())} ${hm}` }