调整编辑功能
This commit is contained in:
@@ -853,16 +853,24 @@ new Vue({
|
||||
},
|
||||
formatDateTime(datetime) {
|
||||
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}`;
|
||||
try {
|
||||
// 确保输入是有效的日期字符串
|
||||
const date = new Date(datetime);
|
||||
if (isNaN(date.getTime())) {
|
||||
return 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}`;
|
||||
} catch (e) {
|
||||
console.error('Date parsing error:', e);
|
||||
return datetime; // 如果出错,返回原始字符串
|
||||
}
|
||||
},
|
||||
refreshTasks() {
|
||||
this.loadTasks();
|
||||
|
||||
Reference in New Issue
Block a user