mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 01:06:35 +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()) {
|
if (shouldPolyfillDateTime()) {
|
||||||
polyfills.push(import("@formatjs/intl-datetimeformat/polyfill"));
|
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 hassCallApi from "../util/hass-call-api";
|
||||||
import { getLocalLanguage } from "../util/common-translation";
|
import { getLocalLanguage } from "../util/common-translation";
|
||||||
import { HassBaseEl } from "./hass-base-mixin";
|
import { HassBaseEl } from "./hass-base-mixin";
|
||||||
|
import { polyfillsLoaded } from "../common/translations/localize";
|
||||||
|
|
||||||
export const connectionMixin = <T extends Constructor<HassBaseEl>>(
|
export const connectionMixin = <T extends Constructor<HassBaseEl>>(
|
||||||
superClass: T
|
superClass: T
|
||||||
@ -180,12 +181,18 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
|
|||||||
|
|
||||||
subscribeEntities(conn, (states) => this._updateHass({ states }));
|
subscribeEntities(conn, (states) => this._updateHass({ states }));
|
||||||
subscribeConfig(conn, (config) => {
|
subscribeConfig(conn, (config) => {
|
||||||
if (
|
if (this.hass?.config?.time_zone !== config.time_zone) {
|
||||||
this.hass?.config?.time_zone !== config.time_zone &&
|
if (__BUILD__ === "latest" && polyfillsLoaded) {
|
||||||
"__setDefaultTimeZone" in Intl.DateTimeFormat
|
polyfillsLoaded.then(() => {
|
||||||
) {
|
if ("__setDefaultTimeZone" in Intl.DateTimeFormat) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
Intl.DateTimeFormat.__setDefaultTimeZone(config.time_zone);
|
Intl.DateTimeFormat.__setDefaultTimeZone(config.time_zone);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if ("__setDefaultTimeZone" in Intl.DateTimeFormat) {
|
||||||
|
// @ts-ignore
|
||||||
|
Intl.DateTimeFormat.__setDefaultTimeZone(config.time_zone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._updateHass({ config });
|
this._updateHass({ config });
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user