Loadpoint UI: finer energy select (#29298)
This commit is contained in:
parent
2fb900c8ea
commit
033d055d66
1 changed files with 2 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ export function optionStep(maxEnergy: number) {
|
|||
if (maxEnergy < 10) return 0.5;
|
||||
if (maxEnergy < 25) return 1;
|
||||
if (maxEnergy < 50) return 2;
|
||||
if (maxEnergy < 75) return 2.5;
|
||||
return 5;
|
||||
}
|
||||
|
||||
|
|
@ -21,7 +22,7 @@ export function fmtEnergy(
|
|||
return zeroText;
|
||||
}
|
||||
const inKWh = step >= 0.1;
|
||||
const digits = inKWh && step < 1 ? 1 : 0;
|
||||
const digits = inKWh && !Number.isInteger(step) ? 1 : 0;
|
||||
return fmtWh(energy * 1e3, inKWh ? POWER_UNIT.KW : POWER_UNIT.W, true, digits);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue