Bar/Battery: improved tooltip and handle negative charging rate
- Also slightly tweaked StyledTooltip minimum size to avoid inconsistencies (Tooltip with a single line looked like pills instead of rounded rectangles)
This commit is contained in:
parent
de94d94265
commit
7639900f38
3 changed files with 51 additions and 12 deletions
18
Helpers/Time.js
Normal file
18
Helpers/Time.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function formatVagueHumanReadableTime(totalSeconds) {
|
||||
const hours = Math.floor(totalSeconds / 3600);
|
||||
const minutes = Math.floor((totalSeconds - (hours * 3600)) / 60);
|
||||
const seconds = totalSeconds - (hours * 3600) - (minutes * 60);
|
||||
|
||||
var str = "";
|
||||
if (hours) {
|
||||
str += hours.toString() + "h";
|
||||
}
|
||||
if (minutes) {
|
||||
str += minutes.toString() + "m";
|
||||
}
|
||||
if (!hours && !minutes) {
|
||||
str += seconds.toString() + "s";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue