mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-22 00:36:34 +00:00
Fix datetime polyfill for latest build (#10572)
This commit is contained in:
parent
67d79d618a
commit
a268040ae7
@ -32,6 +32,7 @@ if (__BUILD__ === "latest") {
|
||||
}
|
||||
if (shouldPolyfillDateTime()) {
|
||||
polyfills.push(import("@formatjs/intl-datetimeformat/polyfill"));
|
||||
polyfills.push(import("@formatjs/intl-datetimeformat/add-all-tz"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@ import { getState } from "../util/ha-pref-storage";
|
||||
import hassCallApi from "../util/hass-call-api";
|
||||
import { getLocalLanguage } from "../util/common-translation";
|
||||
import { HassBaseEl } from "./hass-base-mixin";
|
||||
import { polyfillsLoaded } from "../common/translations/localize";
|
||||
|
||||
export const connectionMixin = <T extends Constructor<HassBaseEl>>(
|
||||
superClass: T
|
||||
@ -180,12 +181,18 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
|
||||
|
||||
subscribeEntities(conn, (states) => this._updateHass({ states }));
|
||||
subscribeConfig(conn, (config) => {
|
||||
if (
|
||||
this.hass?.config?.time_zone !== config.time_zone &&
|
||||
"__setDefaultTimeZone" in Intl.DateTimeFormat
|
||||
) {
|
||||
// @ts-ignore
|
||||
Intl.DateTimeFormat.__setDefaultTimeZone(config.time_zone);
|
||||
if (this.hass?.config?.time_zone !== config.time_zone) {
|
||||
if (__BUILD__ === "latest" && polyfillsLoaded) {
|
||||
polyfillsLoaded.then(() => {
|
||||
if ("__setDefaultTimeZone" in Intl.DateTimeFormat) {
|
||||
// @ts-ignore
|
||||
Intl.DateTimeFormat.__setDefaultTimeZone(config.time_zone);
|
||||
}
|
||||
});
|
||||
} else if ("__setDefaultTimeZone" in Intl.DateTimeFormat) {
|
||||
// @ts-ignore
|
||||
Intl.DateTimeFormat.__setDefaultTimeZone(config.time_zone);
|
||||
}
|
||||
}
|
||||
this._updateHass({ config });
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user