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 LOCALE = 'de-DE';
|
||||
|
||||
function normalizeText(value) {
|
||||
return value
|
||||
.toLowerCase()
|
||||
@@ -80,7 +82,7 @@ function resolveInitialTheme() {
|
||||
}
|
||||
|
||||
function buildLocalLabel(timeZone) {
|
||||
const formatter = Intl.DateTimeFormat(undefined, {
|
||||
const formatter = Intl.DateTimeFormat(LOCALE, {
|
||||
timeZone,
|
||||
timeZoneName: 'longGeneric'
|
||||
});
|
||||
@@ -95,7 +97,7 @@ function buildLocalLabel(timeZone) {
|
||||
}
|
||||
|
||||
function formatClockValue(date, timeZone) {
|
||||
return new Intl.DateTimeFormat(undefined, {
|
||||
return new Intl.DateTimeFormat(LOCALE, {
|
||||
timeZone,
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
@@ -105,7 +107,7 @@ function formatClockValue(date, timeZone) {
|
||||
}
|
||||
|
||||
function formatDateValue(date, timeZone) {
|
||||
return new Intl.DateTimeFormat(undefined, {
|
||||
return new Intl.DateTimeFormat(LOCALE, {
|
||||
timeZone,
|
||||
weekday: 'long',
|
||||
year: 'numeric',
|
||||
|
Reference in New Issue
Block a user