fix: localize date formatting
This commit is contained in:
8
app.js
8
app.js
@@ -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',
|
||||||
|
Reference in New Issue
Block a user