Commit ddb81de5 authored by Christian Winther's avatar Christian Winther
Browse files

allow hour, day, week and year time rounding

parent c4219ba0
......@@ -534,12 +534,30 @@ function($, _, moment) {
if (size < 1000) {
return size.toFixed(0) + " ms";
}
// Less than 1 min
else if (size < 60000) {
return (size / 1000).toFixed(decimals) + " s";
}
else {
// Less than 1 hour, devide in minutes
else if (size < 3600000) {
return (size / 60000).toFixed(decimals) + " min";
}
// Less than one day, devide in hours
else if (size < 86400000) {
return (size / 3600000).toFixed(decimals) + " hour";
}
// Less than one week, devide in days
else if (size < 604800000) {
return (size / 86400000).toFixed(decimals) + " day";
}
// Less than one month, devide in weeks
else if (size < 2.62974e9) {
return (size / 604800000).toFixed(decimals) + " week";
}
// Less than one year, devide in weeks
else if (size < 3.15569e10) {
return (size / 2.62974e9).toFixed(decimals) + " year";
}
};
kbn.microsFormat = function(size, decimals) {
......@@ -555,4 +573,4 @@ function($, _, moment) {
};
return kbn;
});
\ No newline at end of file
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment