[Frontend][全域功能] displayDate Function 更新
This commit is contained in:
parent
a920c364f5
commit
6565685b5c
@ -288,20 +288,20 @@ function displayDate(dateTime, dateType = "YMdHms", locale = 'zh-TW') {
|
|||||||
dateType.indexOf("S") != -1 ? millisecond = parseInt(d.getMilliseconds()) : "";
|
dateType.indexOf("S") != -1 ? millisecond = parseInt(d.getMilliseconds()) : "";
|
||||||
} else if (dateType == "date") {
|
} else if (dateType == "date") {
|
||||||
year = d.getFullYear();
|
year = d.getFullYear();
|
||||||
month = String(d.getMonth() + 1).padStart(2, '0');
|
month = d.getMonth() + 1;
|
||||||
day = String(d.getDate()).padStart(2, '0');
|
day = d.getDate();
|
||||||
} else if (dateType == "time") {
|
} else if (dateType == "time") {
|
||||||
hour = String(d.getHours()).padStart(2, '0');
|
hour = d.getHours();
|
||||||
minute = String(d.getMinutes()).padStart(2, '0');
|
minute = d.getMinutes();
|
||||||
} else if (dateType == "datetime") {
|
} else if (dateType == "datetime") {
|
||||||
year = d.getFullYear();
|
year = d.getFullYear();
|
||||||
month = String(d.getMonth() + 1).padStart(2, '0');
|
month = d.getMonth() + 1;
|
||||||
day = String(d.getDate()).padStart(2, '0');
|
day = d.getDate();
|
||||||
hour = String(d.getHours()).padStart(2, '0');
|
hour = d.getHours();
|
||||||
minute = String(d.getMinutes()).padStart(2, '0');
|
minute = d.getMinutes();
|
||||||
}
|
}
|
||||||
date = [year, month, day].filter(n => n).join("/");
|
date = [year, String(month).padStart(2, '0'), String(day).padStart(2, '0')].filter(n => n).join("/");
|
||||||
time = [hour, minute, second, millisecond].filter(n => n).join(":");
|
time = [String(hour).padStart(2, '0'), String(minute).padStart(2, '0')].filter(n => n).join(":");
|
||||||
result = date.toString() + " " + time.toString();
|
result = date.toString() + " " + time.toString();
|
||||||
|
|
||||||
if (dateType == "date") {
|
if (dateType == "date") {
|
||||||
|
Loading…
Reference in New Issue
Block a user