showing 12 hour format
This commit is contained in:
@@ -57,6 +57,19 @@ module.exports = {
|
|||||||
this.autoCheckUpgrade = this.config.admin["auto-check-upgrade"];
|
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: {
|
methods: {
|
||||||
fetch_current_time: async function () {
|
fetch_current_time: async function () {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ script#admin-general-view-template(type="text/x-template")
|
|||||||
p
|
p
|
||||||
strong Current Date/Time:
|
strong Current Date/Time:
|
||||||
span(v-if="isLoadingTime") Loading...
|
span(v-if="isLoadingTime") Loading...
|
||||||
span(v-else) {{ current_time }}
|
span(v-else) {{ get_current_time }}
|
||||||
|
|
||||||
label
|
label
|
||||||
input(type="checkbox" v-model="is_24_hr_format")
|
input(type="checkbox" v-model="is_24_hr_format")
|
||||||
|
|||||||
Reference in New Issue
Block a user