Skip to content

Commit

Permalink
fixing issue when same timer value is added both as number and as string
Browse files Browse the repository at this point in the history
  • Loading branch information
dmatik committed Dec 30, 2024
1 parent 2a2b9a7 commit 8cd7f60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dist/switcher-boiler-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,12 @@ class SwitcherBoilerCard extends LitElement {
event.preventDefault();

// Create a unique, sorted array, filter values, and convert back to strings
const timerValues = [...new Set(this.config.timer_values || ['15', '30', '45', '60'])]
const timerValues = [...new Set((this.config.timer_values || ['15', '30', '45', '60'])
.map(Number) // Convert all values to numbers
.filter((value) => value >= 1 && value <= 150) // Keep only values in the range of 1 and 150
.sort((a, b) => a - b) // Sort numerically
.map(String); // Convert back to strings

.map(String) // Convert back to strings
)];
const currentIndex = timerValues.indexOf(this.timerValue);

// Fallback to the first value if currentValue is not in the array
Expand Down

0 comments on commit 8cd7f60

Please sign in to comment.