FE: locale for date formats #1335

Signed-off-by: jokob-sk <jokob.sk@gmail.com>
This commit is contained in:
jokob-sk
2025-12-11 21:29:52 +11:00
parent 88904dc892
commit 08e6e0e15e
2 changed files with 33 additions and 3 deletions

View File

@@ -369,13 +369,15 @@ function getLangCode() {
return lang_code;
}
const tz = getSetting("TIMEZONE") || 'Europe/Berlin';
const LOCALE = getSetting('UI_LOCALE') || 'en-GB';
// -----------------------------------------------------------------------------
// String utilities
// -----------------------------------------------------------------------------
function localizeTimestamp(input) {
let tz = getSetting("TIMEZONE") || 'Europe/Berlin';
input = String(input || '').trim();
// 1. Unix timestamps (10 or 13 digits)
@@ -450,7 +452,7 @@ function localizeTimestamp(input) {
console.error(`ERROR: Couldn't parse date: '${str}' with TIMEZONE ${tz}`);
return 'Failed conversion - Check browser console';
}
return new Intl.DateTimeFormat('default', {
return new Intl.DateTimeFormat(LOCALE, {
timeZone: tz,
year: 'numeric', month: '2-digit', day: '2-digit',
hour: '2-digit', minute: '2-digit', second: '2-digit',