mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-25 05:47:20 +00:00
Ensure numeric attributes are formatted correctly (#11336)
This commit is contained in:
parent
9fffc93e5d
commit
52588a3915
@ -3,6 +3,7 @@ import { until } from "lit/directives/until";
|
||||
import checkValidDate from "../common/datetime/check_valid_date";
|
||||
import { formatDate } from "../common/datetime/format_date";
|
||||
import { formatDateTimeWithSeconds } from "../common/datetime/format_date_time";
|
||||
import { formatNumber } from "../common/number/format_number";
|
||||
import { capitalizeFirstLetter } from "../common/string/capitalize-first-letter";
|
||||
import { isDate } from "../common/string/is_date";
|
||||
import { isTimestamp } from "../common/string/is_timestamp";
|
||||
@ -190,6 +191,10 @@ export function formatAttributeValue(
|
||||
return html`<pre>${until(yaml, "")}</pre>`;
|
||||
}
|
||||
|
||||
if (typeof value === "number") {
|
||||
return formatNumber(value, hass.locale);
|
||||
}
|
||||
|
||||
if (typeof value === "string") {
|
||||
// URL handling
|
||||
if (value.startsWith("http")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user