重构:优化配置管理的 date 格式化

This commit is contained in:
YunaiV
2023-03-10 09:45:40 +08:00
parent 72b0ec23f5
commit 0dd3b77f2d
2 changed files with 28 additions and 10 deletions

View File

@ -1,3 +1,5 @@
import dayjs from 'dayjs'
/**
* 时间日期转换
* @param date 当前时间new Date() 格式
@ -174,3 +176,18 @@ export function formatPast2(ms) {
return 0 + '秒'
}
}
/**
* element plus 的时间 Formatter 实现,使用 YYYY-MM-DD HH:mm:ss 格式
*
* @param row 行数据
* @param column 字段
* @param cellValue 字段值
*/
// @ts-ignore
export const dateFormatter = (row, column, cellValue) => {
if (!cellValue) {
return
}
return dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss')
}