Show solar forecast even if no prod stats available (#9632)

This commit is contained in:
Paulus Schoutsen 2021-07-28 09:20:31 -07:00 committed by GitHub
parent 4d330fba8a
commit 521d5df064
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -261,10 +261,6 @@ export class HuiEnergySolarGraphCard
const datasets: ChartDataset<"bar">[] = [];
let endTime: Date;
if (statisticsData.length === 0) {
return;
}
endTime = new Date(
Math.max(
...statisticsData.map((stats) =>
@ -273,7 +269,7 @@ export class HuiEnergySolarGraphCard
)
);
if (endTime > new Date()) {
if (!endTime || endTime > new Date()) {
endTime = new Date();
}