From c36bfe6927392149d129f12d7c0eb03bf86b8b92 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Thu, 23 Nov 2023 21:44:41 +0100 Subject: [PATCH] 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