Commit 997f5dcb by liang ce

时间处理组建封装

parent 7b33387f
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().length >= 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 }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment