diff --git a/modules/ui/fields/date.js b/modules/ui/fields/date.js index 560713dd04..d410350fbb 100644 --- a/modules/ui/fields/date.js +++ b/modules/ui/fields/date.js @@ -22,7 +22,7 @@ export function uiFieldDate(field, context) { let edtfKey = field.key + ':edtf'; - let dateTimeFormat = new Intl.DateTimeFormat(localizer.languageCode(), { + let dateTimeFormat = new Intl.DateTimeFormat(localizer.localeCodes(), { year: 'numeric', era: 'short', month: 'long', @@ -37,7 +37,7 @@ export function uiFieldDate(field, context) { * @param year A representative year within the era. */ function getEraName(year, format) { - let longFormat = new Intl.DateTimeFormat(localizer.languageCode(), { + let longFormat = new Intl.DateTimeFormat(localizer.localeCodes(), { year: 'numeric', era: format, timeZone: 'UTC', @@ -76,7 +76,7 @@ export function uiFieldDate(field, context) { /// Returns the localized name of a month in the given format. function getMonthName(month, format) { - let longFormat = new Intl.DateTimeFormat(localizer.languageCode(), { + let longFormat = new Intl.DateTimeFormat(localizer.localeCodes(), { month: format, timeZone: 'UTC', }); diff --git a/modules/validations/invalid_format.js b/modules/validations/invalid_format.js index eaf7c292b4..d567ded123 100644 --- a/modules/validations/invalid_format.js +++ b/modules/validations/invalid_format.js @@ -41,7 +41,7 @@ export function validationFormatting() { let alternatives = []; if (normalized !== null) { - let label = normalized.date.toLocaleDateString(localizer.languageCode(), normalized.localeOptions); + let label = normalized.date.toLocaleDateString(localizer.localeCodes(), normalized.localeOptions); alternatives.push({ date: normalized.value, label: label || normalized.value, @@ -51,7 +51,7 @@ export function validationFormatting() { if (edtfFromOSM) { let label; try { - label = edtf.default(edtfFromOSM).format(localizer.languageCode()); + label = edtf.default(edtfFromOSM).format(localizer.localeCode()); } catch (e) { label = edtfFromOSM; } @@ -105,7 +105,7 @@ export function validationFormatting() { if (parserError.offset && parserError.token) { message = t.append('issues.invalid_format.edtf.reference', { token: parserError.token.value, - position: (parserError.offset + 1).toLocaleString(localizer.languageCode()), + position: (parserError.offset + 1).toLocaleString(localizer.localeCodes()), }); } else if (parserError.message) { message = selection => selection.append('span')