From 0fbf2f375faa11b3b57b4e0adf980e14b5b105d0 Mon Sep 17 00:00:00 2001 From: Substancia Date: Tue, 3 Oct 2023 03:50:04 +0530 Subject: [PATCH] fix PR comments --- src/components/PingChart.vue | 5 ++--- src/lang/en.json | 5 ++++- src/mixins/datetime.js | 12 +++++------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/components/PingChart.vue b/src/components/PingChart.vue index 9950756f3..6400e3f5a 100644 --- a/src/components/PingChart.vue +++ b/src/components/PingChart.vue @@ -64,9 +64,8 @@ export default { }, computed: { chartOptions() { - const minuteTimeFormat = `${ - this.use12HourTimeFormat ? "hh" : "HH" - }:mm${ + const hourTimeFormat = this.use12HourTimeFormat ? "hh" : "HH"; + const minuteTimeFormat = `${hourTimeFormat}:mm${ this.use12HourTimeFormat ? " A" : "" }`; return { diff --git a/src/lang/en.json b/src/lang/en.json index c75dd7c86..ed624f450 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -838,5 +838,8 @@ "successDisabled": "Disabled Successfully.", "successEnabled": "Enabled Successfully.", "tagNotFound": "Tag not found.", - "foundChromiumVersion": "Found Chromium/Chrome. Version: {0}" + "foundChromiumVersion": "Found Chromium/Chrome. Version: {0}", + "Time Format": "Time Format", + "12-hour": "12 Hour", + "24-hour": "24 Hour" } diff --git a/src/mixins/datetime.js b/src/mixins/datetime.js index 380cfc94d..42287e1ea 100644 --- a/src/mixins/datetime.js +++ b/src/mixins/datetime.js @@ -35,17 +35,15 @@ export default { /** * Return a given value in the format YYYY-MM-DD HH:mm:ss * @param {any} value Value to format as date time - * @param {boolean} use12HourFormat Whether to use 12-hour format + * @param {boolean} use12HourTimeFormat Whether to use 12-hour format * @returns {string} Formatted string */ - datetime(value, use12HourFormat = false) { + datetime(value, use12HourTimeFormat = false) { + const hourTimeFormat = use12HourTimeFormat ? "hh" : "HH"; const timeFormat = - `YYYY-MM-DD ${ - use12HourFormat ? "hh" : "HH" - }:mm:ss${ - use12HourFormat ? " A" : "" + `YYYY-MM-DD ${hourTimeFormat}:mm:ss${ + use12HourTimeFormat ? " A" : "" }`; - console.log(timeFormat); return this.datetimeFormat(value, timeFormat); },