Fix "24" hour time

This commit is contained in:
Natsumi
2022-02-08 04:58:11 +13:00
parent fdfc80eacd
commit cc9ed48de0
3 changed files with 23 additions and 23 deletions
+2 -2
View File
@@ -19032,7 +19032,7 @@ speechSynthesis.getVoices();
hour: 'numeric', hour: 'numeric',
minute: 'numeric', minute: 'numeric',
second: 'numeric', second: 'numeric',
hour12 hourCycle: (hour12 ? 'h12' : 'h23')
}); });
} else if (format === 'short') { } else if (format === 'short') {
return dt return dt
@@ -19041,7 +19041,7 @@ speechSynthesis.getVoices();
day: '2-digit', day: '2-digit',
hour: 'numeric', hour: 'numeric',
minute: 'numeric', minute: 'numeric',
hour12 hourCycle: (hour12 ? 'h12' : 'h23')
}) })
.replace(' AM', 'am') .replace(' AM', 'am')
.replace(' PM', 'pm') .replace(' PM', 'pm')
+1 -1
View File
@@ -1016,7 +1016,7 @@ html
div.options-container-item div.options-container-item
span.name Enable span.name Enable
el-switch(v-model="openVR" @change="saveOpenVROption") el-switch(v-model="openVR" @change="saveOpenVROption")
div.options-container-item div.options-container-item(style="min-width:118px")
span.name Start overlay with span.name Start overlay with
el-switch(v-model="openVRAlways" @change="saveOpenVROption" inactive-text="VRChat" active-text="SteamVR" :disabled="!openVR") el-switch(v-model="openVRAlways" @change="saveOpenVROption" inactive-text="VRChat" active-text="SteamVR" :disabled="!openVR")
div.options-container-item div.options-container-item
+20 -20
View File
@@ -46,30 +46,30 @@ Vue.component('marquee-text', MarqueeText);
.join(' '); .join(' ');
Vue.filter('textToHex', textToHex); Vue.filter('textToHex', textToHex);
var timeToText = (t) => { var timeToText = function (sec) {
var sec = Number(t); var n = Number(sec);
if (isNaN(sec)) { if (isNaN(n)) {
return escapeTag(t); return escapeTag(sec);
} }
sec = Math.floor(sec / 1000); n = Math.floor(n / 1000);
var arr = []; var arr = [];
if (sec < 0) { if (n < 0) {
sec = -sec; n = -n;
} }
if (sec >= 86400) { if (n >= 86400) {
arr.push(`${Math.floor(sec / 86400)}d`); arr.push(`${Math.floor(n / 86400)}d`);
sec %= 86400; n %= 86400;
} }
if (sec >= 3600) { if (n >= 3600) {
arr.push(`${Math.floor(sec / 3600)}h`); arr.push(`${Math.floor(n / 3600)}h`);
sec %= 3600; n %= 3600;
} }
if (sec >= 60) { if (n >= 60) {
arr.push(`${Math.floor(sec / 60)}m`); arr.push(`${Math.floor(n / 60)}m`);
sec %= 60; n %= 60;
} }
if (sec || !arr.length) { if (arr.length === 0 && n < 60) {
arr.push(`${sec}s`); arr.push(`${n}s`);
} }
return arr.join(' '); return arr.join(' ');
}; };
@@ -327,7 +327,7 @@ Vue.component('marquee-text', MarqueeText);
year: 'numeric', year: 'numeric',
hour: 'numeric', hour: 'numeric',
minute: 'numeric', minute: 'numeric',
hour12: this.config.dtHour12 hourCycle: (this.config.dtHour12 ? 'h12' : 'h23')
}) })
.replace(' AM', ' am') .replace(' AM', ' am')
.replace(' PM', ' pm') .replace(' PM', ' pm')
@@ -603,7 +603,7 @@ Vue.component('marquee-text', MarqueeText);
.toLocaleTimeString($app.currentCulture, { .toLocaleTimeString($app.currentCulture, {
hour: '2-digit', hour: '2-digit',
minute: 'numeric', minute: 'numeric',
hour12: $app.config.dtHour12 hourCycle: ($app.config.dtHour12 ? 'h12' : 'h23')
}) })
.replace(' am', '') .replace(' am', '')
.replace(' pm', ''); .replace(' pm', '');