fix:功能调整

This commit is contained in:
tianyongbao
2024-06-06 18:42:02 +08:00
parent 568125d792
commit bdc80f29ef
20 changed files with 1050 additions and 56 deletions

View File

@@ -51,4 +51,34 @@ export function tansParams(params:any) {
}
}
return result
}
// 时间返回 yyyy-mm-dd hh:mm:ss
export function timeHandler(d, unit1, unit2) {
const year = d.getFullYear()
const month = addZero(d.getMonth() + 1)
const day = addZero(d.getDate())
const hours = addZero(d.getHours())
const minute = addZero(d.getMinutes())
const second = addZero(d.getSeconds())
const time = year + unit1 + month + unit1 + day + ' ' + hours + unit2 + minute + unit2 + second
return time
}
// 时间返回 mm-dd hh:mm
export function timeHandler2(d, unit1, unit2) {
const year = d.getFullYear()
const month = addZero(d.getMonth() + 1)
const day = addZero(d.getDate())
const hours = addZero(d.getHours())
const minute = addZero(d.getMinutes())
const second = addZero(d.getSeconds())
const time = month + unit1 + day + ' ' + hours + unit2 + minute
return time
}
export function addZero(num) {
if (num < 10) {
return '0' + num
} else {
return num
}
}