本文整理汇总了TypeScript中@grafana/ui/src/utils/moment_wrapper.isDateTime函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isDateTime函数的具体用法?TypeScript isDateTime怎么用?TypeScript isDateTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isDateTime函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: timeRangeForUrl
timeRangeForUrl() {
const range = this.timeRange().raw;
if (isDateTime(range.from)) {
range.from = range.from.valueOf().toString();
}
if (isDateTime(range.to)) {
range.to = range.to.valueOf().toString();
}
return range;
}
开发者ID:grafana,项目名称:grafana,代码行数:12,代码来源:TimeSrv.ts
示例2: timeRange
timeRange(): TimeRange {
// make copies if they are moment (do not want to return out internal moment, because they are mutable!)
const raw = {
from: isDateTime(this.time.from) ? dateTime(this.time.from) : this.time.from,
to: isDateTime(this.time.to) ? dateTime(this.time.to) : this.time.to,
};
const timezone = this.dashboard && this.dashboard.getTimezone();
return {
from: dateMath.parse(raw.from, false, timezone),
to: dateMath.parse(raw.to, true, timezone),
raw: raw,
};
}
开发者ID:grafana,项目名称:grafana,代码行数:15,代码来源:TimeSrv.ts
示例3:
const toRawTimeRange = (range: TimeRange): RawTimeRange => {
let from = range.raw.from;
if (isDateTime(from)) {
from = from.valueOf().toString(10);
}
let to = range.raw.to;
if (isDateTime(to)) {
to = to.valueOf().toString(10);
}
return {
from,
to,
};
};
开发者ID:johntdyer,项目名称:grafana,代码行数:16,代码来源:actions.ts
示例4:
const toUser = currentValue => {
if (isDateTime(currentValue)) {
return currentValue.format(format);
} else {
return currentValue;
}
};
开发者ID:grafana,项目名称:grafana,代码行数:7,代码来源:validation.ts
示例5: setTime
setTime(time: RawTimeRange, fromRouteUpdate?: boolean) {
_.extend(this.time, time);
// disable refresh if zoom in or zoom out
if (isDateTime(time.to)) {
this.oldRefresh = this.dashboard.refresh || this.oldRefresh;
this.setAutoRefresh(false);
} else if (this.oldRefresh && this.oldRefresh !== this.dashboard.refresh) {
this.setAutoRefresh(this.oldRefresh);
this.oldRefresh = null;
}
// update url
if (fromRouteUpdate !== true) {
const urlRange = this.timeRangeForUrl();
const urlParams = this.$location.search();
urlParams.from = urlRange.from;
urlParams.to = urlRange.to;
this.$location.search(urlParams);
}
this.$timeout(this.refreshDashboard.bind(this), 0);
}
开发者ID:grafana,项目名称:grafana,代码行数:23,代码来源:TimeSrv.ts
示例6: it
it('should return parsed when parse is true', () => {
timeSrv.setTime({ from: 'now', to: 'now-1h' });
const time = timeSrv.timeRange();
expect(isDateTime(time.from)).toBe(true);
expect(isDateTime(time.to)).toBe(true);
});
开发者ID:grafana,项目名称:grafana,代码行数:6,代码来源:TimeSrv.test.ts
注:本文中的@grafana/ui/src/utils/moment_wrapper.isDateTime函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论