故障告警接口联调

This commit is contained in:
白菜
2025-07-01 14:42:53 +08:00
parent 9b78635fd8
commit 99b019ebc9
2 changed files with 20 additions and 8 deletions

View File

@ -6,9 +6,14 @@ export const formatNumber = (val) => {
}
export const formatDate = (val) => {
export const formatDate = (val,toSeconds = false) => {
if(!val) return ''
const date = new Date(val)
const month = date.getMonth() + 1,day = date.getDate()
return `${date.getFullYear()}-${month<10?'0'+month : month}-${day<10 ? '0'+day : day}`
if(!toSeconds){
return `${date.getFullYear()}-${month<10?'0'+month : month}-${day<10 ? '0'+day : day}`
}else{
const hours = date.getHours(),minuets=date.getMinutes(),seconds = date.getSeconds();
return `${date.getFullYear()}-${month<10?'0'+month : month}-${day<10 ? '0'+day : day} ${hours<10 ? '0'+hours : hours}:${minuets<10 ? '0'+minuets : minuets}:${seconds<10 ? '0'+seconds : seconds}`
}
}