task#13769,时间测试

This commit is contained in:
2024-05-15 19:49:04 +08:00
parent 1a1336e7ec
commit 441d4eb2d4
2 changed files with 15 additions and 8 deletions

View File

@ -5,7 +5,13 @@ const formatDate = date => {
const day = tempDate.getDate()
return `${[year, month, day].map(formatNumber).join('-')}`
}
const formatDate1 = date => {
let tempDate = new Date(date)
const year = tempDate.getFullYear()
const month = tempDate.getMonth() + 1
const day = tempDate.getDate()
return `${[year, month, day].map(formatNumber).join('/')}`
}
const formatNumber = n => {
n = n.toString()
return n[1] ? n : `0${n}`
@ -40,5 +46,6 @@ module.exports = {
formatNumber,
formatDate,
leftCopy,
timeFormat
timeFormat,
formatDate1
}