Organise datetime utils
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { FieldType, DataFrameDTO } from '../types/dataFrame';
|
||||
import { DateTime } from '../utils/moment_wrapper';
|
||||
import { DateTime } from '../datetime/moment_wrapper';
|
||||
import { MutableDataFrame } from './MutableDataFrame';
|
||||
import { DataFrameView } from './DataFrameView';
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
sortDataFrame,
|
||||
} from './processDataFrame';
|
||||
import { FieldType, TimeSeries, TableData, DataFrameDTO } from '../types/index';
|
||||
import { dateTime } from '../utils/moment_wrapper';
|
||||
import { dateTime } from '../datetime/moment_wrapper';
|
||||
import { MutableDataFrame } from './MutableDataFrame';
|
||||
|
||||
describe('toDataFrame', () => {
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
FieldDTO,
|
||||
DataFrameDTO,
|
||||
} from '../types/index';
|
||||
import { isDateTime } from '../utils/moment_wrapper';
|
||||
import { isDateTime } from '../datetime/moment_wrapper';
|
||||
import { deprecationWarning } from '../utils/deprecationWarning';
|
||||
import { ArrayVector } from '../vector/ArrayVector';
|
||||
import { MutableDataFrame } from './MutableDataFrame';
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import sinon, { SinonFakeTimers } from 'sinon';
|
||||
import each from 'lodash/each';
|
||||
|
||||
import * as dateMath from './datemath';
|
||||
import { dateTime, DurationUnit, DateTime } from '../utils/moment_wrapper';
|
||||
import { dateTime, DurationUnit, DateTime } from './moment_wrapper';
|
||||
|
||||
describe('DateMath', () => {
|
||||
const spans: DurationUnit[] = ['s', 'm', 'h', 'd', 'w', 'M', 'y'];
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import includes from 'lodash/includes';
|
||||
import isDate from 'lodash/isDate';
|
||||
import { DateTime, dateTime, dateTimeForTimeZone, ISO_8601, isDateTime, DurationUnit } from './moment_wrapper';
|
||||
import { TimeZone } from '../types';
|
||||
import { TimeZone } from '../types/index';
|
||||
|
||||
const units: DurationUnit[] = ['y', 'M', 'w', 'd', 'h', 'm', 's'];
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
// Names are too general to export globally
|
||||
import * as dateMath from './datemath';
|
||||
import * as rangeUtil from './rangeutil';
|
||||
export * from './moment_wrapper';
|
||||
export { dateMath, rangeUtil };
|
||||
+1
-1
@@ -4,7 +4,7 @@ import groupBy from 'lodash/groupBy';
|
||||
import { RawTimeRange } from '../types/time';
|
||||
|
||||
import * as dateMath from './datemath';
|
||||
import { isDateTime, DateTime } from '../utils/moment_wrapper';
|
||||
import { isDateTime, DateTime } from './moment_wrapper';
|
||||
|
||||
const spans: { [key: string]: { display: string; section?: number } } = {
|
||||
s: { display: 'second' },
|
||||
@@ -3,3 +3,4 @@ export * from './types';
|
||||
export * from './vector';
|
||||
export * from './dataframe';
|
||||
export * from './transformations';
|
||||
export * from './datetime';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DateTime } from '../utils/moment_wrapper';
|
||||
import { DateTime } from '../datetime/moment_wrapper';
|
||||
|
||||
export interface RawTimeRange {
|
||||
from: DateTime | string;
|
||||
|
||||
@@ -8,13 +8,7 @@ export * from './logs';
|
||||
export * from './labels';
|
||||
export * from './labels';
|
||||
export * from './object';
|
||||
export * from './moment_wrapper';
|
||||
export * from './thresholds';
|
||||
export * from './text';
|
||||
|
||||
export { getMappedValue } from './valueMappings';
|
||||
|
||||
// Names are too general to export globally
|
||||
import * as dateMath from './datemath';
|
||||
import * as rangeUtil from './rangeutil';
|
||||
export { dateMath, rangeUtil };
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
jest.mock('@grafana/data/src/utils/moment_wrapper', () => ({
|
||||
jest.mock('@grafana/data/src/datetime/moment_wrapper', () => ({
|
||||
dateTime: (ts: any) => {
|
||||
return {
|
||||
valueOf: () => ts,
|
||||
|
||||
Reference in New Issue
Block a user