mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Fix Energy-Dashboard unexpected Period Calculation (#23458)
* if not whole month, better use days for the period * fix Type undefined error * Update src/data/energy.ts Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com> --------- Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
This commit is contained in:
parent
a94460a0c7
commit
2ff0cb58bc
@ -401,7 +401,13 @@ const getEnergyData = async (
|
||||
|
||||
const dayDifference = differenceInDays(end || new Date(), start);
|
||||
const period =
|
||||
dayDifference > 35 ? "month" : dayDifference > 2 ? "day" : "hour";
|
||||
isFirstDayOfMonth(start) &&
|
||||
(!end || isLastDayOfMonth(end)) &&
|
||||
dayDifference > 35
|
||||
? "month"
|
||||
: dayDifference > 2
|
||||
? "day"
|
||||
: "hour";
|
||||
|
||||
const lengthUnit = hass.config.unit_system.length || "";
|
||||
const energyUnits: StatisticsUnitConfiguration = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user