automatically set peak label using publicConfig.graphDuration

This commit is contained in:
Nick Krecklow
2020-04-01 22:36:44 -05:00
parent ad6907b0cc
commit 9f5827f06c
3 changed files with 13 additions and 2 deletions

View File

@ -163,8 +163,18 @@ function msToTime(timer) {
var minutes = timer % 60;
var hours = (timer - minutes) / 60;
var days = Math.floor(hours / 24);
hours -= days * 24;
var string = '';
// hack: only format days if >1, if === 1 it will format as "24h" instead
if (days > 1) {
string += days + 'd';
} else if (days === 1) {
hours += 24;
}
if (hours > 0) {
string += hours + 'h';
}