Skip to content

Commit

Permalink
import moment from moment-timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
jaskfla committed Mar 8, 2024
1 parent 13cecba commit b6695ec
Show file tree
Hide file tree
Showing 44 changed files with 57 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import React, { useState } from 'react';
import moment from 'moment';
import moment from 'moment-timezone';
import { DateTimePicker, RadioGroup } from '@tupaia/ui-components';
import { stripTimezoneFromDate } from '@tupaia/utils';
import { ReduxAutocomplete } from '../autocomplete';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import React from 'react';
import Typography from '@material-ui/core/Typography';
import PropTypes from 'prop-types';
import moment from 'moment';
import moment from 'moment-timezone';
import styled from 'styled-components';
import { ResourcePage } from './ResourcePage';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import React from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import moment from 'moment-timezone';
import { getBrowserTimeZone } from '@tupaia/utils';
import { ApprovalStatus } from '@tupaia/types';
import { ResourcePage } from './ResourcePage';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@

import React from 'react';
import { Link } from 'react-router-dom';
import moment from 'moment';
import moment from 'moment-timezone';
import { InputAdornment } from '@material-ui/core';
import styled from 'styled-components';
import {
Button,
TextField,
Checkbox,
DatePicker,
DateTimePicker,
HexcodeField,
ImageUploadField,
RadioGroup,
Select,
ImageUploadField,
HexcodeField,
Checkbox,
TextField,
} from '@tupaia/ui-components';
import { stripTimezoneFromDate } from '@tupaia/utils';
import { registerInputField } from './InputField';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
*/

import xlsx from 'xlsx';
import moment from 'moment';
import moment from 'moment-timezone';
import keyBy from 'lodash.keyby';
import chunk from 'lodash.chunk';
import groupBy from 'lodash.groupby';
import {
addExportedDateAndOriginAtTheSheetBottom,
getExportDatesString,
getUniqueEntries,
truncateString,
toFilename,
truncateString,
} from '@tupaia/utils';
import { TYPES } from '@tupaia/database';
import { ANSWER_TYPES, NON_DATA_ELEMENT_ANSWER_TYPES } from '../../../database/models/Answer';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import xlsx from 'xlsx';
import moment from 'moment';
import moment from 'moment-timezone';
import { generateId } from '@tupaia/database';
import {
constructIsOneOf,
Expand All @@ -14,11 +14,11 @@ import {
hasContent,
ImportValidationError,
ObjectValidator,
reduceToDictionary,
respond,
stripTimezoneFromDate,
takesIdForm,
UploadError,
reduceToDictionary,
stripTimezoneFromDate,
} from '@tupaia/utils';

import { getArrayQueryParameter } from '../../utilities';
Expand Down
4 changes: 2 additions & 2 deletions packages/central-server/src/database/models/SurveyResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
*/

import momentTimezone from 'moment-timezone';
import moment from 'moment';
import moment from 'moment-timezone';

import { MaterializedViewLogDatabaseModel, DatabaseType, TYPES } from '@tupaia/database';
import { DatabaseType, MaterializedViewLogDatabaseModel, TYPES } from '@tupaia/database';

export const SURVEY_RESPONSE_APPROVAL_STATUS = {
NOT_REQUIRED: 'not_required',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Copyright (c) 2019 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import { DHIS2_RESOURCE_TYPES, dhisToTupaiaPeriodType, combineDiagnostics } from '@tupaia/dhis-api';
import moment from 'moment-timezone';
import { combineDiagnostics, DHIS2_RESOURCE_TYPES, dhisToTupaiaPeriodType } from '@tupaia/dhis-api';
import {
DEFAULT_PERIOD_TYPE,
periodToType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import {} from 'dotenv/config'; // Load the environment variables into process.env
import { expect } from 'chai';
import moment from 'moment';
import moment from 'moment-timezone';

import { randomEmail } from '@tupaia/utils';
import { getAuthorizationHeader, TestableApp } from '../../testUtilities';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { expect } from 'chai';
import groupBy from 'lodash.groupby';
import pick from 'lodash.pick';
import moment from 'moment';
import moment from 'moment-timezone';

import {
buildAndInsertSurveys,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { expect } from 'chai';
import sinon from 'sinon';
import moment from 'moment';
import moment from 'moment-timezone';

import { buildAndInsertSurveys, generateTestId, upsertDummyRecord } from '@tupaia/database';
import { oneSecondSleep, randomIntBetween } from '@tupaia/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tupaia MediTrak
* Copyright (c) 2019 Beyond Essential Systems Pty Ltd
*/
import moment from 'moment';
import moment from 'moment-timezone';
import { generateTestId, TYPES } from '@tupaia/database';
import { ANSWER_TYPES } from '../../../../../database/models/Answer';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2019 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';
import sinon from 'sinon';
import { expect } from 'chai';
import { AggregateDataPusher } from '../../../../../dhis/pushers/data/aggregate/AggregateDataPusher';
Expand Down
2 changes: 1 addition & 1 deletion packages/data-api/src/TupaiaDataApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import groupBy from 'lodash.groupby';

import moment from 'moment';
import moment from 'moment-timezone';
import { TupaiaDatabase, SqlQuery } from '@tupaia/database';
import { getSortByKey, DEFAULT_BINARY_OPTIONS, yup } from '@tupaia/utils';
import { isNotNullish } from '@tupaia/tsutils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2018 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';

const formatDate = (date: string, format: string) => moment.parseZone(date).format(format);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2017 - 2021 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';

import { SupersetApi } from '@tupaia/superset-api';
import { Service } from '../Service';
Expand Down
2 changes: 1 addition & 1 deletion packages/data-lake-api/src/DataLakeApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import groupBy from 'lodash.groupby';

import moment from 'moment';
import moment from 'moment-timezone';
import { getSortByKey } from '@tupaia/utils';
import { DataLakeAnalyticsFetchQuery } from './DataLakeAnalyticsFetchQuery';
import { DataLakeEventsFetchQuery, Event } from './DataLakeEventsFetchQuery';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

import moment from 'moment';
import moment from 'moment-timezone';

var dbm;
var type;
Expand Down
2 changes: 1 addition & 1 deletion packages/database/src/modelClasses/FeedItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2017 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';

import { DatabaseModel } from '../DatabaseModel';
import { DatabaseType } from '../DatabaseType';
Expand Down
2 changes: 1 addition & 1 deletion packages/database/src/modelClasses/OneTimeLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2017 Beyond Essential Systems Pty Ltd
*/
import randomToken from 'rand-token';
import moment from 'moment';
import moment from 'moment-timezone';
import { DatabaseError, UnauthenticatedError } from '@tupaia/utils';

import { DatabaseModel } from '../DatabaseModel';
Expand Down
2 changes: 1 addition & 1 deletion packages/database/src/testUtilities/clearTestData.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2017 - 2020 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';
import { AnalyticsRefresher } from '..';

const COMPARISON = `LIKE '%_test%'`;
Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/cypress/scripts/generateConfig/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { uniq } from 'lodash';
import moment from 'moment';
import moment from 'moment-timezone';

import { compareAsc, readJsonFile, yup, yupUtils } from '@tupaia/utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import React, { useState } from 'react';
import moment from 'moment';
import moment from 'moment-timezone';
import { DateTimePicker, RadioGroup } from '@tupaia/ui-components';
import { ReduxAutocomplete, ExportModal } from '@tupaia/admin-panel';
import { stripTimezoneFromDate } from '@tupaia/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tupaia
* Copyright (c) 2017 - 2021 Beyond Essential Systems Pty Ltd
*/
import moment from 'moment';
import moment from 'moment-timezone';
import { getBrowserTimeZone } from '@tupaia/utils';
import { getImportConfigs } from './getImportConfigs';
import { getSurveyResponsesExportModal } from '../../components';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
* Copyright (c) 2018 Beyond Essential Systems Pty Ltd
*/

import React, { PureComponent } from 'react';
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import moment from 'moment-timezone';

import { DateQuestion } from './DateQuestion';
import { formatPlural } from '../../utilities';
import {DateQuestion} from './DateQuestion';
import {formatPlural} from '../../utilities';

class TimeSinceQuestion extends PureComponent {
render() {
Expand Down
2 changes: 1 addition & 1 deletion packages/meditrak-app/app/utilities/format.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Tupaia MediTrak
* Copyright (c) 2017 Beyond Essential Systems Pty Ltd
*/
import moment from 'moment';
import moment from 'moment-timezone';

export const formatPlural = (singular, plural, count) =>
count === 1 ? singular.replace('@count', count) : plural.replace('@count', count);
Expand Down
2 changes: 1 addition & 1 deletion packages/tsutils/src/__tests__/datetime.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2017 - 2022 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';

import { getTimezoneNameFromTimestamp } from '../datetime';

Expand Down
4 changes: 2 additions & 2 deletions packages/tsutils/src/datetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2017 - 2022 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';
import momentTimezone from 'moment-timezone';

/**
Expand All @@ -19,4 +19,4 @@ export const getTimezoneNameFromTimestamp = (timestamp: string) =>
.names()
.find(name => getUtcOffsetFromTimestamp(timestamp) === momentTimezone.tz(name).format('Z'));

export const utcMoment = (...args: Parameters<typeof moment['utc']>) => moment.utc(...args);
export const utcMoment = (...args: Parameters<(typeof moment)['utc']>) => moment.utc(...args);
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { RefObject, useContext, useEffect } from 'react';
import moment from 'moment';
import moment from 'moment-timezone';
import downloadJs from 'downloadjs';
import domtoimage from 'dom-to-image';
import { useParams } from 'react-router-dom';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-chart-components/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';
import { useTheme } from '@material-ui/core/styles';
import {
CartesianChartPresentationOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import React from 'react';
import { screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import moment from 'moment';
import moment from 'moment-timezone';
import {
DEFAULT_MIN_DATE,
GRANULARITIES,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React, { useEffect, useState } from 'react';
import moment from 'moment';
import moment from 'moment-timezone';
import styled from 'styled-components';
import { DialogProps, Typography } from '@material-ui/core';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React from 'react';
import moment from 'moment';
import moment from 'moment-timezone';
import { MenuItem } from '../Inputs';
import { DatePicker } from './DatePicker';
import { BaseDatePickerProps } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React from 'react';
import moment from 'moment';
import moment from 'moment-timezone';
import { MenuItem } from '../Inputs';
import { DatePicker } from './DatePicker';
import { BaseDatePickerProps } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';
import React from 'react';
import MuiBox from '@material-ui/core/Box';
import styled from 'styled-components';
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-map-components/src/utils/markerColors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
*/

import moment from 'moment';
import moment from 'moment-timezone';
import { blue, red, green } from '@material-ui/core/colors';
import { ScaleType, MeasureColorScheme } from '@tupaia/types';
import { BREWER_PALETTE, HEATMAP_UNKNOWN_COLOR } from '../constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2017 - 2021 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';

import { utcMoment } from '../../datetime';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2017 - 2020 Beyond Essential Systems Pty Ltd
*/

import moment from 'moment';
import moment from 'moment-timezone';

import { convertDateRangeToPeriods } from '../../period/convertDateRangeToPeriods';

Expand Down
Loading

0 comments on commit b6695ec

Please sign in to comment.