diff --git a/front/js/common.js b/front/js/common.js index 675c36e3..8e7b0365 100755 --- a/front/js/common.js +++ b/front/js/common.js @@ -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', diff --git a/front/plugins/ui_settings/config.json b/front/plugins/ui_settings/config.json index aeb14706..20fc84df 100755 --- a/front/plugins/ui_settings/config.json +++ b/front/plugins/ui_settings/config.json @@ -26,6 +26,34 @@ ], "params": [], "settings": [ + { + "function": "LOCALE", + "type": { + "dataType": "string", + "elements": [ + { + "elementType": "input", + "elementOptions": [], + "transformers": [] + } + ] + }, + "default_value": "en-GB", + "options": [], + "localized": ["name", "description"], + "name": [ + { + "language_code": "en_us", + "string": "Locale" + } + ], + "description": [ + { + "language_code": "en_us", + "string": "The locale used to format dates that are displayed in the UI." + } + ] + }, { "function": "NOT_RANDOM_MAC", "type": {