showing 12 hour format

This commit is contained in:
sanjayk03-dev
2024-09-04 18:42:35 +05:30
parent d537af5f91
commit 7a81786964
2 changed files with 14 additions and 1 deletions

View File

@@ -57,6 +57,19 @@ module.exports = {
this.autoCheckUpgrade = this.config.admin["auto-check-upgrade"];
},
computed: {
get_current_time: function () {
if (this.is_24_hr_format == true) {
return this.current_time;
} else {
const [hour, minutes, seconds] = this.current_time.split(":");
const suffix = hour >= 12 ? "PM" : "AM";
const hour12 = (hour % 12 || 12).toString().padStart(2, "0");
return `${hour12}:${minutes}:${seconds} ${suffix}`;
}
},
},
methods: {
fetch_current_time: async function () {
try {

View File

@@ -68,7 +68,7 @@ script#admin-general-view-template(type="text/x-template")
p
strong Current Date/Time:
span(v-if="isLoadingTime") Loading...
span(v-else) {{ current_time }}
span(v-else) {{ get_current_time }}
label
input(type="checkbox" v-model="is_24_hr_format")