mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-25 13:57:21 +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) {
|
||||
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`
|
||||
if (isNumericState(stateObj)) {
|
||||
@ -123,7 +126,11 @@ export const computeStateDisplay = (
|
||||
domain === "scene" ||
|
||||
(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 (
|
||||
|
Loading…
x
Reference in New Issue
Block a user