[Frontend][全域功能] displayDate Function 更新

This commit is contained in:
dev01 2022-11-23 17:27:42 +08:00
parent a920c364f5
commit 6565685b5c

View File

@ -288,20 +288,20 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') {
dateType.indexOf("S") != -1 ? millisecond = parseInt(d.getMilliseconds()) : "";
} else if (dateType == "date") {
year = d.getFullYear();
month = String(d.getMonth() + 1).padStart(2, '0');
day = String(d.getDate()).padStart(2, '0');
month = d.getMonth() + 1;
day = d.getDate();
} else if (dateType == "time") {
hour = String(d.getHours()).padStart(2, '0');
minute = String(d.getMinutes()).padStart(2, '0');
hour = d.getHours();
minute = d.getMinutes();
} else if (dateType == "datetime") {
year = d.getFullYear();
month = String(d.getMonth() + 1).padStart(2, '0');
day = String(d.getDate()).padStart(2, '0');
hour = String(d.getHours()).padStart(2, '0');
minute = String(d.getMinutes()).padStart(2, '0');
month = d.getMonth() + 1;
day = d.getDate();
hour = d.getHours();
minute = d.getMinutes();
}
date = [year, month, day].filter(n => n).join("/");
time = [hour, minute, second, millisecond].filter(n => n).join(":");
date = [year, String(month).padStart(2, '0'), String(day).padStart(2, '0')].filter(n => n).join("/");
time = [String(hour).padStart(2, '0'), String(minute).padStart(2, '0')].filter(n => n).join(":");
result = date.toString() + " " + time.toString();
if (dateType == "date") {