fix(settings): clock format "auto" follows the app's UI language (#758)

Auto previously passed `undefined` to `toLocaleTimeString`, which falls
back to the JS engine's default locale. Inside WebKitGTK that resolves
to `en-US` for many users regardless of `LC_TIME`, so the queue ETA and
sleep-timer preview rendered 12h AM/PM even when the OS clock was 24h.

Pass `i18n.language` instead, matching the convention already used in
the theme-scheduler hour picker (AppearanceTab.tsx). Explicit 12h/24h
choices still override.
This commit is contained in:
Frank Stellmacher
2026-05-17 19:53:11 +02:00
committed by GitHub
parent 33ffb94083
commit 8ac5a69a7c
3 changed files with 11 additions and 7 deletions
+6 -4
View File
@@ -2,12 +2,14 @@ import type { ClockFormat } from '../../store/authStoreTypes';
/**
* Localized wall-clock `HH:MM` for a timestamp (sleep-timer / queue-ETA labels).
* `clockFormat` overrides the system locale's `hour12` default — pass `'auto'`
* or omit to keep locale-driven behaviour.
* `clockFormat` overrides the locale's `hour12` default. `'auto'` (or omitted)
* defers to `locale` — pass `i18n.language` so the App's UI language picks the
* 12h/24h convention; the JS engine's default locale is unreliable inside
* WebKitGTK and often resolves to `en-US` regardless of OS `LC_TIME`.
*/
export function formatClockTime(timestampMs: number, clockFormat?: ClockFormat): string {
export function formatClockTime(timestampMs: number, clockFormat?: ClockFormat, locale?: string): string {
const hour12 = clockFormat === '24h' ? false : clockFormat === '12h' ? true : undefined;
return new Date(timestampMs).toLocaleTimeString(undefined, {
return new Date(timestampMs).toLocaleTimeString(locale, {
hour: '2-digit',
minute: '2-digit',
hour12,