From a22a37a994b7827df07a710fd0f607c68e9a9d84 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 23 Nov 2023 20:53:45 +0100 Subject: [PATCH 1/2] fix: fix 12-hour time format in ETA output Signed-off-by: Stefan Dej --- src/store/printer/getters.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/store/printer/getters.ts b/src/store/printer/getters.ts index f5cffaeb6..ae86074d9 100644 --- a/src/store/printer/getters.ts +++ b/src/store/printer/getters.ts @@ -763,6 +763,7 @@ export const getters: GetterTree = { if (hours12Format && h > 11) am = false if (hours12Format && h > 12) h -= 12 + if (hours12Format && h == 0) h += 12 if (h < 10) h = '0' + h const m = date.getMinutes() >= 10 ? date.getMinutes() : '0' + date.getMinutes() From 7ff5c777d17be59449e1adc2a09f3f375af0fa4c Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 23 Nov 2023 21:44:41 +0100 Subject: [PATCH 2/2] fix: fix 12hour browser time format detection (#1660) --- src/store/gui/getters.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/store/gui/getters.ts b/src/store/gui/getters.ts index c0142e8e1..bdd6c980a 100644 --- a/src/store/gui/getters.ts +++ b/src/store/gui/getters.ts @@ -157,9 +157,7 @@ export const getters: GetterTree = { const setting = state.general.timeFormat if (setting === '12hours') return true if (setting === null) { - // create a time string, cut the last 2 chars and check if it contains AM or PM - const timeString = new Date().toLocaleString(navigator.language, { timeStyle: 'short' }).slice(-2) - if (['AM', 'PM'].includes(timeString)) return true + return Intl.DateTimeFormat(navigator.language, { hour: 'numeric' }).resolvedOptions().hour12 } return false