前端时间格式调整

This commit is contained in:
liuwei
2025-06-10 15:24:59 +08:00
parent 9201ea48fe
commit 2427b2c722

View File

@@ -852,7 +852,17 @@ new Vue({
return statusMap[status] || '';
},
formatDateTime(datetime) {
return new Date(datetime).toLocaleString()
if (!datetime) return '';
// 解析 GMT 时间字符串
const date = new Date(datetime);
const year = date.getUTCFullYear();
const month = String(date.getUTCMonth() + 1).padStart(2, '0');
const day = String(date.getUTCDate()).padStart(2, '0');
const hours = String(date.getUTCHours()).padStart(2, '0');
const minutes = String(date.getUTCMinutes()).padStart(2, '0');
const seconds = String(date.getUTCSeconds()).padStart(2, '0');
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
},
refreshTasks() {
this.loadTasks();