本文整理匯總了TypeScript中app/core/utils/rangeutil.describeTimeRange函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript describeTimeRange函數的具體用法?TypeScript describeTimeRange怎麽用?TypeScript describeTimeRange使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了describeTimeRange函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('Date range with relative to absolute', () => {
const text = rangeUtil.describeTimeRange({
from: 'now-7d',
to: moment([2014, 10, 10, 2, 3, 4]),
});
expect(text).toBe('7 days ago to Nov 10, 2014 02:03:04');
});
示例2: it
it('Date range with absolute to now', () => {
var text = rangeUtil.describeTimeRange({
from: moment([2014, 10, 10, 2, 3, 4]),
to: 'now',
});
expect(text).toBe('Nov 10, 2014 02:03:04 to a few seconds ago');
});
示例3: it
it('Date range with from and to both are either in now-* or now+* format', () => {
var text = rangeUtil.describeTimeRange({from: 'now-6h', to: 'now+1h'});
expect(text).to.be('now-6h to now+1h')
});
示例4: it
it('Date range with from and to both are in now-* format', () => {
var text = rangeUtil.describeTimeRange({from: 'now-6h', to: 'now-3h'});
expect(text).toBe('now-6h to now-3h');
});