Chore: Replaces moment with Grafanas DateTime (#16919)

* Wip: Initial commit

* Refactor: Replaces moment.utc(

* Refactor: replaces the last isMoment statements

* Refactor: Removes almost all moment imports

* Refactor: Moves moment_wrapper to grafana/ui

* Refactor: Renames momentWrapper

* Refactor: Removes one more moment import

* Refactor: Removes unitOfTime import

* Fix: Fixes Prettier error

* Refactor: Renames DateTimeType to DateTime

* Refactor: Renames isDateTimeType to isDateTime

* Refactor: Renames dateTime to dateTime

* Feature: Bans moment imports and types
This commit is contained in:
Hugo Häggmark
2019-05-08 13:51:44 +02:00
committed by GitHub
parent e7a9afe983
commit ceb9f0855b
86 changed files with 583 additions and 484 deletions

View File

@ -1,6 +1,6 @@
import moment from 'moment';
import { PostgresDatasource } from '../datasource';
import { CustomVariable } from 'app/features/templating/custom_variable';
import { toUtc, dateTime } from '@grafana/ui/src/utils/moment_wrapper';
describe('PostgreSQLDatasource', () => {
const instanceSettings = { name: 'postgresql' };
@ -10,8 +10,8 @@ describe('PostgreSQLDatasource', () => {
replace: jest.fn(text => text),
};
const raw = {
from: moment.utc('2018-04-25 10:00'),
to: moment.utc('2018-04-25 11:00'),
from: toUtc('2018-04-25 10:00'),
to: toUtc('2018-04-25 11:00'),
};
const ctx = {
backendSrv,
@ -39,8 +39,8 @@ describe('PostgreSQLDatasource', () => {
rawQuery: 'select time, title, text, tags from table;',
},
range: {
from: moment(1432288354),
to: moment(1432288401),
from: dateTime(1432288354),
to: dateTime(1432288401),
},
};