修复 时间 格式化为题

This commit is contained in:
张成
2025-10-18 17:47:09 +08:00
parent de52dc4762
commit 62bc0d9c24
6 changed files with 114 additions and 84 deletions

View File

@@ -185,6 +185,7 @@ const QueryTransactions = () => {
const format_time = (time: string) => {
time = time.replace(/-/g, "/");
const date = new Date(time);
const year = String(date.getFullYear());
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
@@ -192,7 +193,7 @@ const QueryTransactions = () => {
const seconds = String(date.getSeconds()).padStart(2, "0");
return {
date: `2025-${month}-${day}`,
date: `${year}-${month}-${day}`,
time: `${hours}:${minutes}:${seconds}`,
};
};

View File

@@ -377,6 +377,7 @@ const WalletPage: React.FC = () => {
const format_time = (time: string) => {
time = time.replace(/-/g, "/");
const date = new Date(time);
const year = String(date.getFullYear());
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
const hours = String(date.getHours()).padStart(2, "0");
@@ -384,7 +385,7 @@ const WalletPage: React.FC = () => {
const seconds = String(date.getSeconds()).padStart(2, "0");
return {
date: `2025-${month}-${day}`,
date: `${year}-${month}-${day}`,
time: `${hours}:${minutes}:${seconds}`,
};
};