utils.js 619 Bytes
const mwUtils = {
  timeToStr: function (time) {
    let timeData = new Date(parseInt(time))
    let year = timeData.getFullYear()
    let month = (timeData.getMonth() + 1) >= 10 ? timeData.getMonth() + 1 : `0${timeData.getMonth() + 1}`
    let date = timeData.getDate() >= 10 ? timeData.getDate() : `0${timeData.getDate()}`
    let hour = timeData.getHours() >= 10 ? timeData.getHours() : `0${timeData.getHours()}`
    let minute = timeData.getMinutes().toString().length > 1 ? timeData.getMinutes() : `0${timeData.getMinutes()}`
    return `${year}${month}${date}${hour}:${minute}`
  }
}
export { mwUtils }