// 格式化为yyyy-mm-dd hh:mm export const formatDate = ms => { console.log(ms) if (!ms) return '' const date = new Date(ms) let year = date.getFullYear() let month = date.getMonth() + 1 let day = date.getDate() let hour = date.getHours() let minute = date.getMinutes() month = month < 10 ? '0' + month : month day = day < 10 ? '0' + day : day hour = hour < 10 ? '0' + hour : hour minute = minute < 10 ? '0' + minute : minute let formatDataed = `${year}-${month}-${day} ${hour}:${minute}` return formatDataed }