Skip to content

Commit

Permalink
Fix invalid unit on current charge on batteries (#1562)
Browse files Browse the repository at this point in the history
  • Loading branch information
DEv0on authored Jul 9, 2024
1 parent 01894be commit 28ab4c4
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,18 @@ private static void addCurrentChargeTooltip(List<Component> tooltip, long curren
long currentChargeTime;
long maxChargeTime;
String unit;
if (durationCurrent.getSeconds() <= 180) {
currentChargeTime = durationCurrent.getSeconds();
} else if (durationCurrent.toMinutes() <= 180) {
currentChargeTime = durationCurrent.toMinutes();
} else {
currentChargeTime = durationCurrent.toHours();
}

if (durationMax.getSeconds() <= 180) {
maxChargeTime = durationMax.getSeconds();
currentChargeTime = durationCurrent.toSeconds();
unit = LocalizationUtils.format("item.gtceu.battery.charge_unit.second");
} else if (durationMax.toMinutes() <= 180) {
maxChargeTime = durationMax.toMinutes();
currentChargeTime = durationCurrent.toMinutes();
unit = LocalizationUtils.format("item.gtceu.battery.charge_unit.minute");
} else {
maxChargeTime = durationMax.toHours();
currentChargeTime = durationCurrent.toHours();
unit = LocalizationUtils.format("item.gtceu.battery.charge_unit.hour");
}

Expand Down

0 comments on commit 28ab4c4

Please sign in to comment.