Skip to content

Commit 3847c56

Browse files
authored
Merge pull request #21 from fsteccanella/fsteccanella-patch-1
Cast to Number only if !isNaN
2 parents 1a9ffb1 + cd3c2ea commit 3847c56

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bar-card.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1011,11 +1011,16 @@ class BarCard extends HTMLElement {
10111011
} else {
10121012
entityState = entityObject.state
10131013
}
1014-
if (config.limit_value && !isNaN(entityState)) {
1014+
1015+
if(!isNaN(entityState)){
1016+
entityState = Number(entityState)
1017+
}
1018+
1019+
if (config.limit_value) {
10151020
entityState = Math.min(entityState, configMax)
10161021
entityState = Math.max(entityState, configMin)
10171022
}
1018-
entityState = Number(entityState)
1023+
10191024
if (config.decimal !== false) {
10201025
entityState.toFixed(config.decimal)
10211026
}

0 commit comments

Comments
 (0)