Commit bb6d8ec9 by Torkel Ödegaard

Merge pull request #150 from jippi/better-ms-formatting

allow hour, day, week and year time rounding
parents c4219ba0 ddb81de5
......@@ -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) {
......
Markdown is supported
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