|
|
@@ -214,9 +214,11 @@
|
|
|
// 时间格式化
|
|
|
const formatDate = (date) => {
|
|
|
if (!date) return '';
|
|
|
- const year = date.getFullYear();
|
|
|
- const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
|
- const day = String(date.getDate()).padStart(2, '0');
|
|
|
+ const dateObj = typeof date === 'object' && date instanceof Date ? date : new Date(date);
|
|
|
+ if (isNaN(dateObj.getTime())) return '';
|
|
|
+ const year = dateObj.getFullYear();
|
|
|
+ const month = String(dateObj.getMonth() + 1).padStart(2, '0');
|
|
|
+ const day = String(dateObj.getDate()).padStart(2, '0');
|
|
|
return `${year}-${month}-${day}`; // 输出:****-**-**
|
|
|
};
|
|
|
//转部门格式 “2,3“ -> [2,3]
|