fix(timepicker): fixed displaying of customk time ranges, #2861

This commit is contained in:
Torkel Ödegaard 2015-10-01 16:36:16 +02:00
parent f0f791d226
commit 7dc923a292
2 changed files with 6 additions and 1 deletions

View File

@ -106,7 +106,7 @@ _.each(rangeOptions, function (frame) {
}
}
} else {
opt.display = 'parse error';
opt.display = opt.from + ' to ' + opt.to;
opt.invalid = true;
}

View File

@ -56,6 +56,11 @@ describe("rangeUtil", () => {
expect(text).to.be('Last 1 hour')
});
it('Date range with rounding ranges', () => {
var text = rangeUtil.describeTimeRange({from: 'now/d+6h', to: 'now'});
expect(text).to.be('now/d+6h to now')
});
it('Date range with absolute to now', () => {
var text = rangeUtil.describeTimeRange({from: moment([2014,10,10,2,3,4]), to: 'now'});
expect(text).to.be('Nov 10, 2014 02:03:04 to a few seconds ago')