mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-25 13:57:21 +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 checkValidDate from "../common/datetime/check_valid_date";
|
||||||
import { formatDate } from "../common/datetime/format_date";
|
import { formatDate } from "../common/datetime/format_date";
|
||||||
import { formatDateTimeWithSeconds } from "../common/datetime/format_date_time";
|
import { formatDateTimeWithSeconds } from "../common/datetime/format_date_time";
|
||||||
|
import { formatNumber } from "../common/number/format_number";
|
||||||
import { capitalizeFirstLetter } from "../common/string/capitalize-first-letter";
|
import { capitalizeFirstLetter } from "../common/string/capitalize-first-letter";
|
||||||
import { isDate } from "../common/string/is_date";
|
import { isDate } from "../common/string/is_date";
|
||||||
import { isTimestamp } from "../common/string/is_timestamp";
|
import { isTimestamp } from "../common/string/is_timestamp";
|
||||||
@ -190,6 +191,10 @@ export function formatAttributeValue(
|
|||||||
return html`<pre>${until(yaml, "")}</pre>`;
|
return html`<pre>${until(yaml, "")}</pre>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof value === "number") {
|
||||||
|
return formatNumber(value, hass.locale);
|
||||||
|
}
|
||||||
|
|
||||||
if (typeof value === "string") {
|
if (typeof value === "string") {
|
||||||
// URL handling
|
// URL handling
|
||||||
if (value.startsWith("http")) {
|
if (value.startsWith("http")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user