From 1bc5d77b95c15e5e23940402352da36a32c4547a Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 10 十月 2026 11:55:03 +0800
Subject: [PATCH] fix: 优化日期格式化显示逻辑
---
src/utils/index.js | 23 +++++------------------
1 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/src/utils/index.js b/src/utils/index.js
index 809593f..f268ec7 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -1,27 +1,14 @@
-import { parseTime } from "./ruoyi";
+import { parseTime, dateOnly } from "./ruoyi";
/**
- * 琛ㄦ牸鏃堕棿鏍煎紡鍖�
+ * 琛ㄦ牸鏃堕棿鏍煎紡鍖栵紙鍙樉绀哄勾鏈堟棩锛屼笉鏄剧ず鏃跺垎绉掞級
*/
export function formatDate(cellValue) {
- if (cellValue == null || cellValue == "") return "";
- var date = new Date(cellValue);
- var year = date.getFullYear();
- var month =
- date.getMonth() + 1 < 10
- ? "0" + (date.getMonth() + 1)
- : date.getMonth() + 1;
- var day = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
- var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
- var minutes =
- date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
- var seconds =
- date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
- return (
- year + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + seconds
- );
+ return dateOnly(cellValue);
}
+export { dateOnly };
+
/**
* @param {number} time
* @param {string} option
--
Gitblit v1.9.3