fix:功能调整
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user