Fix endTime of statistics-chart (#24233)

This commit is contained in:
Petar Petrov 2025-02-14 13:53:48 +02:00 committed by Bram Kragten
parent 37ee2bf308
commit c07f4de39d
2 changed files with 4 additions and 3 deletions

View File

@ -273,11 +273,13 @@ export class StatisticsChart extends LitElement {
this._chartOptions = { this._chartOptions = {
xAxis: [ xAxis: [
{ {
id: "xAxis",
type: "time", type: "time",
min: startTime, min: startTime,
max: endTime, max: this.endTime,
}, },
{ {
id: "hiddenAxis",
type: "time", type: "time",
show: false, show: false,
}, },
@ -368,7 +370,6 @@ export class StatisticsChart extends LitElement {
if (endTime > new Date()) { if (endTime > new Date()) {
endTime = new Date(); endTime = new Date();
} }
this.endTime = endTime;
let unit: string | undefined | null; let unit: string | undefined | null;

View File

@ -327,7 +327,7 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard {
); );
const endDate = this._energyEnd; const endDate = this._energyEnd;
try { try {
let unitClass; let unitClass: string | undefined | null;
if (this._config!.unit && this._metadata) { if (this._config!.unit && this._metadata) {
const metadata = Object.values(this._metadata).find( const metadata = Object.values(this._metadata).find(
(metaData) => (metaData) =>