判断时间格式化方法参数为空情况 (#53)

判断时间格式化方法参数为空情况
This commit is contained in:
cai-peiyuan
2019-12-06 17:15:52 +08:00
committed by elunez
parent 4845d41699
commit f138923760

View File

@@ -14,7 +14,9 @@ export function parseTime(time, cFormat) {
}
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
let date
if (typeof time === 'object') {
if (typeof time === 'undefined' || time === null || time === 'null') {
return ''
} else if (typeof time === 'object') {
date = time
} else {
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
@@ -384,4 +386,3 @@ export function downloadFile(obj, name, suffix) {
link.click()
document.body.removeChild(link)
}