Dynamic locale support for date formatting functions

Replaced hardcoded 'de-DE' locale with a new getCurrentCulture function that selects the user's culture from localized.culture or navigator.language. Date formatting now adapts to user language settings in detailedCurrentDate and getLocaleDateString.
This commit is contained in:
2026-02-16 17:34:49 +01:00
parent 7345b8f877
commit 8cf6484786
2 changed files with 5 additions and 3 deletions

View File

@@ -1,9 +1,11 @@
const getCurrentCulture = () => (typeof localized !== 'undefined' && localized.culture) ? localized.culture : (navigator.language || 'en-US');
const B64ToBuff = (base64String) => new Uint8Array(Array.from(atob(base64String), char => char.charCodeAt(0))).buffer;
const getLocaleDateString = _ => new Date().toLocaleDateString('de-DE')
const getLocaleDateString = _ => new Date().toLocaleDateString(getCurrentCulture())
function detailedCurrentDate() {
return new Intl.DateTimeFormat('de-DE', {
return new Intl.DateTimeFormat(getCurrentCulture(), {
day: '2-digit',
month: '2-digit',
year: 'numeric',