本文整理汇总了TypeScript中chronoshift.WallTime.init方法的典型用法代码示例。如果您正苦于以下问题:TypeScript WallTime.init方法的具体用法?TypeScript WallTime.init怎么用?TypeScript WallTime.init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chronoshift.WallTime
的用法示例。
在下文中一共展示了WallTime.init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: require
], (require) => {
var WallTime = require('chronoshift').WallTime;
var queryUrlExecutorFactory = require('./utils/ajax/ajax').queryUrlExecutorFactory;
var AppSettings = require('../common/models/index').AppSettings;
var PivotApplication = require('./views/pivot-application/pivot-application').PivotApplication;
var appSettings = AppSettings.fromJS(config.appSettings).attachExecutors((dataSource: DataSource) => {
return queryUrlExecutorFactory(dataSource.name, 'plywood', version);
});
// Init chronoshift
if (!WallTime.rules) {
var tzData = require('chronoshift/lib/walltime/walltime-data.js');
WallTime.init(tzData.rules, tzData.zones);
}
ReactDOM.render(
React.createElement(
PivotApplication,
{
version,
user: config.user,
appSettings,
readOnly: config.readOnly
}
),
container
);
}, 'pivot-main');
示例2: require
], (require) => {
var List = require('immutable').List;
var WallTime = require('chronoshift').WallTime;
var queryUrlExecutorFactory = require('./utils/ajax/ajax').queryUrlExecutorFactory;
var DataSource = require('../common/models/index').DataSource;
var PivotApplication = require('./components/pivot-application/pivot-application').PivotApplication;
// Init chronoshift
if (!WallTime.rules) {
var tzData = require('chronoshift/lib/walltime/walltime-data.js');
WallTime.init(tzData.rules, tzData.zones);
}
var dataSources = List(config.dataSources.map((dataSourceJS: DataSourceJS) => {
var executor = queryUrlExecutorFactory(dataSourceJS.name, '/plywood', version);
return DataSource.fromJS(dataSourceJS, { executor });
}));
ReactDOM.render(
React.createElement(
PivotApplication,
{
version,
user: config.user,
dataSources,
linkViewConfig: config.linkViewConfig
}
),
container
);
}, 'pivot-main');
示例3: require
], (require) => {
const WallTime = require('chronoshift').WallTime;
const queryUrlExecutorFactory = require('./utils/ajax/ajax').queryUrlExecutorFactory;
const AppSettings = require('../common/models/index').AppSettings;
const MANIFESTS = require('../common/manifests/index').MANIFESTS;
const PivotApplication = require('./views/pivot-application/pivot-application').PivotApplication;
var appSettings = AppSettings.fromJS(config.appSettings, {
visualizations: MANIFESTS,
executorFactory: (dataCube: DataCube) => {
return queryUrlExecutorFactory(dataCube.name, 'plywood', version);
}
});
// Init chronoshift
if (!WallTime.rules) {
var tzData = require('chronoshift/lib/walltime/walltime-data.js');
WallTime.init(tzData.rules, tzData.zones);
}
ReactDOM.render(
React.createElement(
PivotApplication,
{
version,
user: config.user,
appSettings
}
),
container
);
}, 'pivot-main');
示例4: require
import { expect } from 'chai';
import { Timezone, Duration, day, month } from 'chronoshift';
import { TimeRange } from 'plywood';
import { datesEqual, prependDays, appendDays, getEndWallTimeInclusive, getWallTimeDay, getWallTimeMonthWithYear, formatTimeBasedOnGranularity, formatTimeRange } from './time';
var { WallTime } = require('chronoshift');
if (!WallTime.rules) {
var tzData = require("chronoshift/lib/walltime/walltime-data.js");
WallTime.init(tzData.rules, tzData.zones);
}
describe('Time', () => {
it('calculates date equality properly', () => {
expect(datesEqual(null, new Date()), 'null and not null').to.equal(false);
expect(datesEqual(null, null), 'null and null').to.equal(true);
expect(datesEqual(new Date('1995-02-24T00:00:00.000Z'), new Date('1995-02-24T00:00:00.000Z')), 'equal dates').to.equal(true);
expect(datesEqual(new Date('1995-02-24T00:00:00.000Z'), new Date('1995-02-24T00:02:00.000Z')), 'not equal dates').to.equal(false);
});
it('prepends days', () => {
var testFirstWeek: Date[] = [];
for (var i = 1; i < 5; i++) {
testFirstWeek.push(new Date(Date.UTC(1995, 2, i)));
}
var prepended = prependDays(Timezone.UTC, testFirstWeek, 5);
expect(prepended).to.deep.equal([
new Date('1995-02-24T00:00:00.000Z'),
new Date('1995-02-25T00:00:00.000Z'),
new Date('1995-02-26T00:00:00.000Z'),
new Date('1995-02-27T00:00:00.000Z'),