Fix intl polyfill loading (#27261)

This commit is contained in:
Bram Kragten 2025-09-30 15:47:12 +02:00 committed by GitHub
parent 6823c647b6
commit 994c1b5751
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 4 deletions

View File

@ -14,7 +14,15 @@ import {
polyfillTimeZoneData,
} from "./locale-data-polyfill";
let polyfilled = false;
const _polyfillTimeZoneData = polyfillTimeZoneData;
const polyfillIntl = async () => {
if (polyfilled) {
return;
}
polyfilled = true;
const locale = getLocalLanguage();
const polyfills: Promise<unknown>[] = [];
if (shouldPolyfillGetCanonicalLocales()) {
@ -26,7 +34,7 @@ const polyfillIntl = async () => {
if (shouldPolyfillDateTimeFormat(locale)) {
polyfills.push(
import("@formatjs/intl-datetimeformat/polyfill-force").then(() =>
polyfillTimeZoneData()
_polyfillTimeZoneData()
)
);
}
@ -58,7 +66,7 @@ const polyfillIntl = async () => {
if (polyfills.length === 0) {
return;
}
await Promise.all(polyfills).then(() =>
await Promise.allSettled(polyfills).then(() =>
// Load the default language
polyfillLocaleData(locale)
);

View File

@ -19,8 +19,8 @@ export const coreStyles = css`
--ha-border-radius-pill: 9999px;
--ha-border-radius-circle: 50%;
--ha-border-radius-square: 0;
# Spacing
/* Spacing */
--ha-space-0: 0px;
--ha-space-1: 4px;
--ha-space-2: 8px;