fix: localize date formatting

This commit is contained in:
Your Name
2025-10-13 22:49:50 -06:00
parent d58c0723b1
commit b7f3837b1e

8
app.js
View File

@@ -13,6 +13,8 @@ const POPULAR_NAMES = [
const timezoneByName = new Map(SORTED_TIMEZONE_DATA.map((entry) => [entry.name, entry])); const timezoneByName = new Map(SORTED_TIMEZONE_DATA.map((entry) => [entry.name, entry]));
const LOCALE = 'de-DE';
function normalizeText(value) { function normalizeText(value) {
return value return value
.toLowerCase() .toLowerCase()
@@ -80,7 +82,7 @@ function resolveInitialTheme() {
} }
function buildLocalLabel(timeZone) { function buildLocalLabel(timeZone) {
const formatter = Intl.DateTimeFormat(undefined, { const formatter = Intl.DateTimeFormat(LOCALE, {
timeZone, timeZone,
timeZoneName: 'longGeneric' timeZoneName: 'longGeneric'
}); });
@@ -95,7 +97,7 @@ function buildLocalLabel(timeZone) {
} }
function formatClockValue(date, timeZone) { function formatClockValue(date, timeZone) {
return new Intl.DateTimeFormat(undefined, { return new Intl.DateTimeFormat(LOCALE, {
timeZone, timeZone,
hour: '2-digit', hour: '2-digit',
minute: '2-digit', minute: '2-digit',
@@ -105,7 +107,7 @@ function formatClockValue(date, timeZone) {
} }
function formatDateValue(date, timeZone) { function formatDateValue(date, timeZone) {
return new Intl.DateTimeFormat(undefined, { return new Intl.DateTimeFormat(LOCALE, {
timeZone, timeZone,
weekday: 'long', weekday: 'long',
year: 'numeric', year: 'numeric',