Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Malow committed Nov 18, 2023
1 parent 210fb4c commit a896dc0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"main": "src/main.js",
"module": "src/main.js",
"repository": "[email protected]:kalkih/mini-graph-card.git",
"repository": "[email protected]:malow/mini-graph-card.git",
"author": "Karl Kihlström <[email protected]>",
"license": "MIT",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion src/buildConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default (config) => {
conf.color_thresholds,
conf.color_thresholds_transition,
);
const additional = conf.hours_to_show > 24 ? { day: 'numeric', weekday: 'short' } : {};
const additional = conf.hours_to_show > 24 ? { day: 'numeric', weekday: 'long', month: 'long' } : {};
const hourFormat = conf.hour24 ? { hourCycle: 'h23' } : { hour12: true };
conf.format = { ...hourFormat, ...additional };

Expand Down
14 changes: 7 additions & 7 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ class MiniGraphCard extends LitElement {
${this.tooltip.label ? html`
<span>${this.tooltip.label}</span>
` : html`
<span>${this.tooltip.time[0]}</span> -
<span>${this.tooltip.time[1]}</span>
<span>${this.tooltip.time}</span>
`}
</div>
`;
Expand Down Expand Up @@ -528,16 +527,17 @@ class MiniGraphCard extends LitElement {
const now = this.getEndDate();

const oneMinInHours = 1 / 60;
now.setMilliseconds(now.getMilliseconds() - getMilli(offset * id + oneMinInHours));
const end = getTime(now, format, this._hass.language);
now.setMilliseconds(now.getMilliseconds() - getMilli(offset - oneMinInHours));
const start = getTime(now, format, this._hass.language);
now.setMilliseconds(now.getMilliseconds()
- getMilli(offset * id + oneMinInHours)
- getMilli(offset - oneMinInHours) / 2.0);

const time = getTime(now, format, this._hass.language);

this.tooltip = {
value,
id,
entity,
time: [start, end],
time,
index,
label,
};
Expand Down

0 comments on commit a896dc0

Please sign in to comment.