本文整理汇总了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');
});