Skip to content

Commit

Permalink
Fixed broken extrema
Browse files Browse the repository at this point in the history
  • Loading branch information
kalkih committed Feb 13, 2019
1 parent e6a2cbc commit f5b191e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ const DEFAULT_SHOW = {
points: 'hover',
};

const getMin = (arr, val) => {
arr.reduce((min, p) => (Number(p[val]) < Number(min[val]) ? p : min), arr[0]);
};
const getMax = (arr, val) => {
arr.reduce((max, p) => (Number(p[val]) > Number(max[val]) ? p : max), arr[0]);
};
const getMin = (arr, val) => arr.reduce((min, p) => (
Number(p[val]) < Number(min[val]) ? p : min
), arr[0]);
const getMax = (arr, val) => arr.reduce((max, p) => (
Number(p[val]) > Number(max[val]) ? p : max
), arr[0]);
const getTime = (date, hour24) => date.toLocaleString('en-US', { hour: 'numeric', minute: 'numeric', hour12: !hour24 });

class MiniGraphCard extends LitElement {
Expand Down Expand Up @@ -390,7 +390,7 @@ class MiniGraphCard extends LitElement {
<span class='info__item__type'>${entry.type}</span>
<span class='info__item__value'>
${this.computeState(entry.state)}
${this.computeUom(entry)}
${this.computeUom(this.entity[0])}
</span>
<span class='info__item__time'>
${getTime(new Date(entry.last_changed), this.config.hour24)}
Expand Down

0 comments on commit f5b191e

Please sign in to comment.