Commit 305d5c5a by Torkel Ödegaard

Fixes #189, correction to ms axis formater, now formats days correctly

parent 49492e7b
......@@ -597,18 +597,12 @@ function($, _, moment) {
else if (size < 86400000) {
return (size / 3600000).toFixed(decimals) + " hour";
}
// Less than one week, devide in days
else if (size < 604800000) {
// Less than one year, devide in days
else if (size < 31536000000) {
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";
}
return (size / 31536000000).toFixed(decimals) + " year";
};
kbn.microsFormat = function(size, decimals) {
......
define([
'kbn'
], function(kbn) {
describe('millisecond formating', function() {
it('should translate 4378634603 as 1.67 years', function() {
var str = kbn.msFormat(4378634603, 2);
expect(str).to.be('50.68 day');
});
it('should translate 3654454 as 1.02 hour', function() {
var str = kbn.msFormat(3654454, 2);
expect(str).to.be('1.02 hour');
});
it('should translate 365445 as 6.09 min', function() {
var str = kbn.msFormat(365445, 2);
expect(str).to.be('6.09 min');
});
});
});
......@@ -115,6 +115,7 @@ require([
'specs/parser-specs',
'specs/gfunc-specs',
'specs/filterSrv-specs',
'specs/kbn-format-specs',
], function () {
window.__karma__.start();
});
......
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