This commit is contained in:
sanjayk03-dev
2024-09-04 21:17:36 +05:30
parent 1028a63ae1
commit 85900ce406

View File

@@ -60,12 +60,14 @@ module.exports = {
get_current_time: function () { get_current_time: function () {
if (this.config.admin.time_format == true) { if (this.config.admin.time_format == true) {
return this.current_time; return this.current_time;
} else { } else if (this.current_time.length != 0) {
const date_time_array = this.current_time.split(" "); const date_time_array = this.current_time.split(" ");
const [hour, minutes, seconds] = date_time_array[2].split(":"); const [hour, minutes, seconds] = date_time_array[2].split(":");
const suffix = hour >= 12 ? "PM" : "AM"; const suffix = hour >= 12 ? "PM" : "AM";
const hour12 = (hour % 12 || 12).toString().padStart(2, "0"); const hour12 = (hour % 12 || 12).toString().padStart(2, "0");
return `${date_time_array[0]} ${date_time_array[1]} ${hour12}:${minutes}:${seconds} ${suffix}`; return `${date_time_array[0]} ${date_time_array[1]} ${hour12}:${minutes}:${seconds} ${suffix}`;
} else {
return "";
} }
}, },
}, },