mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-08 18:06:36 +00:00
hotfix history view on missing state (#11663)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
bef6591548
commit
d86a18b80b
@ -19,6 +19,9 @@ export const computeStateDisplay = (
|
|||||||
if (compareState === UNKNOWN || compareState === UNAVAILABLE) {
|
if (compareState === UNKNOWN || compareState === UNAVAILABLE) {
|
||||||
return localize(`state.default.${compareState}`);
|
return localize(`state.default.${compareState}`);
|
||||||
}
|
}
|
||||||
|
if (compareState === "") {
|
||||||
|
return localize(`state.default.${UNKNOWN}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Entities with a `unit_of_measurement` or `state_class` are numeric values and should use `formatNumber`
|
// Entities with a `unit_of_measurement` or `state_class` are numeric values and should use `formatNumber`
|
||||||
if (isNumericState(stateObj)) {
|
if (isNumericState(stateObj)) {
|
||||||
@ -123,7 +126,11 @@ export const computeStateDisplay = (
|
|||||||
domain === "scene" ||
|
domain === "scene" ||
|
||||||
(domain === "sensor" && stateObj.attributes.device_class === "timestamp")
|
(domain === "sensor" && stateObj.attributes.device_class === "timestamp")
|
||||||
) {
|
) {
|
||||||
return formatDateTime(new Date(compareState), locale);
|
try {
|
||||||
|
return formatDateTime(new Date(compareState), locale);
|
||||||
|
} catch (_err) {
|
||||||
|
return compareState;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user