@steroidsjs/core 3.0.0-beta.79 → 3.0.0-beta.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,9 +1,26 @@
1
- # Steroids for React
1
+ # Steroids
2
2
 
3
- Find documentation [here](docs/index.md)
3
+ <p align="center">
4
+ <img src="https://i.ibb.co/Q9XvtNc/Group-338025.png" alt="Steroids logo" height="120px">
5
+ </p>
4
6
 
5
- ## Use package from source in project
7
+ <p align="center">
8
+ <a href="https://steroids.kozhindev.com/">Steroids site</a> •
9
+ <a href="https://github.com/steroids/react/issues/new">Submit an Issue</a> •
10
+ <a href="https://t.me/+R0N4XzKbVSYzOTUy">Contact Us</a>
11
+ </p>
12
+
13
+ Our Open-Source **Steroids** framework is an ecosystem based on React and Redux with a large set of ready-made components, unique architecture, UI Kit and SSR
14
+
15
+ ## Why Steroids
16
+
17
+ - **Steroids** contains ready-made project architecture
18
+
19
+ - **Steroids** provides the ability to customize components, thanks to the separation of core and view parts
20
+
21
+ - An extensive library of ready-made components with detailed documentation that simplifies integration into the project
22
+
23
+ - Intuitive design layout of UI components in Figma for quick visualization and adaptation to unique needs
24
+
25
+ Explore and immerse yourself in the world of rapid development through documentation [Documentation](https://steroids.kozhin.dev/ru/docs/getting-started).
6
26
 
7
- 1. Copy `tsconfig-debug.json.sample` to `tsconfig-debug.json`
8
- 2. Replace `outDir` path to node_modules nest path in project
9
- 3. Run from this directory `yarn run watch`
@@ -1,8 +1,34 @@
1
+ /**
2
+ * Интерфейс для ClientStorageComponent
3
+ */
4
+ export interface IClientStorageComponent {
5
+ /**
6
+ * Получить значение из хранилища.
7
+ * @param name Имя записи.
8
+ * @param storageName (Необязательный) Имя хранилища (local, session, или cookie).
9
+ * @returns Значение записи.
10
+ */
11
+ get(name: string, storageName?: 'local' | 'session' | 'cookie'): string | null;
12
+ /**
13
+ * Установить значение в хранилище.
14
+ * @param name Имя записи.
15
+ * @param value Значение записи.
16
+ * @param storageName (Необязательный) Имя хранилища (local, session, или cookie).
17
+ * @param expires (Необязательный) Срок действия записи в миллисекундах.
18
+ */
19
+ set(name: string, value: string, storageName?: 'local' | 'session' | 'cookie', expires?: number | null): void;
20
+ /**
21
+ * Удалить значение из хранилища.
22
+ * @param name Имя записи.
23
+ * @param storageName (Необязательный) Имя хранилища (local, session, или cookie).
24
+ */
25
+ remove(name: string, storageName?: 'local' | 'session' | 'cookie'): void;
26
+ }
1
27
  /**
2
28
  * Client Storage Component
3
29
  * Слой хранения данных в браузере (cookie, local/session storage) или ReactNative
4
30
  */
5
- export default class ClientStorageComponent {
31
+ export default class ClientStorageComponent implements IClientStorageComponent {
6
32
  STORAGE_COOKIE: string;
7
33
  STORAGE_LOCAL: any;
8
34
  STORAGE_SESSION: any;
@@ -26,9 +26,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  exports.__esModule = true;
29
+ /* eslint-disable import/no-extraneous-dependencies */
29
30
  /* eslint-disable no-unused-expressions */
30
31
  var cookie = __importStar(require("js-cookie"));
31
- var moment_1 = __importDefault(require("moment"));
32
+ var dayjs_1 = __importDefault(require("dayjs"));
32
33
  /**
33
34
  * Client Storage Component
34
35
  * Слой хранения данных в браузере (cookie, local/session storage) или ReactNative
@@ -101,7 +102,7 @@ var ClientStorageComponent = /** @class */ (function () {
101
102
  domain: this._getDomain()
102
103
  };
103
104
  if (expires && process.env.IS_SSR) {
104
- options.expires = (0, moment_1["default"])().add(options.expires).utc().toDate();
105
+ options.expires = (0, dayjs_1["default"])().add(options.expires, 'days').utc().toDate();
105
106
  }
106
107
  process.env.IS_SSR ? this._ssrCookie.set(name, value, options) : cookie.set(name, value, options);
107
108
  }
@@ -19,6 +19,7 @@ export default class HttpComponent {
19
19
  _csrfToken: any;
20
20
  _lazyRequests: any;
21
21
  _promises: any;
22
+ _isWindowAvailable: boolean;
22
23
  constructor(components: any, config?: any);
23
24
  getAxiosConfig(): Promise<{
24
25
  withCredentials: boolean;
@@ -65,9 +65,10 @@ var HttpComponent = /** @class */ (function () {
65
65
  if (config === void 0) { config = {}; }
66
66
  this.accessTokenKey = 'accessToken';
67
67
  this._components = components;
68
+ this._isWindowAvailable = !process.env.IS_SSR && process.env.PLATFORM !== 'mobile';
68
69
  this.apiUrl = config.apiUrl
69
70
  //|| process.env.APP_BACKEND_URL
70
- || (!process.env.IS_SSR ? window.location.protocol + '//' + window.location.host : '');
71
+ || (this._isWindowAvailable ? window.location.protocol + '//' + window.location.host : '');
71
72
  this.accessTokenKey = config.accessTokenKey || 'accessToken';
72
73
  this.clientStorageName = config.clientStorageName || this._components.clientStorage.STORAGE_COOKIE;
73
74
  this.clientStorageExpiresIn = config.clientStorageExpiresIn || 180;
@@ -200,7 +201,7 @@ var HttpComponent = /** @class */ (function () {
200
201
  });
201
202
  };
202
203
  HttpComponent.prototype.getUrl = function (method) {
203
- if (method === null && !process.env.IS_SSR) {
204
+ if (method === null && this._isWindowAvailable) {
204
205
  method = window.location.pathname;
205
206
  }
206
207
  if (method.indexOf('://') === -1) {
@@ -310,7 +311,7 @@ var HttpComponent = /** @class */ (function () {
310
311
  store.dispatch((0, notifications_1.setFlashes)(response.data.flashes));
311
312
  }
312
313
  // Ajax redirect
313
- if (response.data.redirectUrl && !process.env.IS_SSR) {
314
+ if (response.data.redirectUrl && this._isWindowAvailable) {
314
315
  if (window.location.href === response.data.redirectUrl.split('#')[0]) {
315
316
  window.location.href = response.data.redirectUrl;
316
317
  window.location.reload();
@@ -1,13 +1,60 @@
1
- import moment from 'moment';
2
- import 'moment/locale/it';
3
- import 'moment/locale/ru';
1
+ import dayjs from 'dayjs';
2
+ import 'dayjs/locale/it';
3
+ import 'dayjs/locale/ru';
4
+ /**
5
+ * Интерфейс для LocaleComponent
6
+ */
7
+ export interface ILocaleComponent {
8
+ /**
9
+ * Разница времени с бекендом (в микросекундах)
10
+ */
11
+ backendTimeDiff: null;
12
+ /**
13
+ * Временная зона бекенда
14
+ */
15
+ backendTimeZone: any;
16
+ /**
17
+ * Язык приложения
18
+ * @example ru
19
+ */
20
+ language: string;
21
+ /**
22
+ * Исходный язык
23
+ */
24
+ sourceLanguage: string;
25
+ /**
26
+ * Переводы сообщений
27
+ */
28
+ translations: any;
29
+ /**
30
+ * Получение экземпляра `dayjs` с учетом временной зоны бекенда
31
+ * @param date Дата
32
+ * @param format Формат даты
33
+ * @returns Экземпляр `dayjs`
34
+ */
35
+ dayjs(date?: string, format?: string): dayjs.Dayjs;
36
+ /**
37
+ * Алиас для метода `translate`
38
+ * @param message Сообщение для перевода
39
+ * @param params Параметры перевода
40
+ * @returns Переведенное сообщение
41
+ */
42
+ t(message: string, params?: Record<string, any>): string;
43
+ /**
44
+ * Перевод сообщения
45
+ * @param message Сообщение для перевода
46
+ * @param params Параметры перевода
47
+ * @returns Переведенное сообщение
48
+ */
49
+ translate(message: string, params?: Record<string, any>): string;
50
+ }
4
51
  /**
5
52
  * Locale Component
6
53
  * Компонент для локализации приложения. Поддерживает конфигурацию языка и временной зоны
7
54
  *
8
55
  * Пример строки: `{__('{count} {count, plural, one{день} few{дня} many{дней}}', {count: 2})}`
9
56
  */
10
- export default class LocaleComponent {
57
+ export default class LocaleComponent implements ILocaleComponent {
11
58
  backendTimeDiff: null;
12
59
  backendTimeZone: any;
13
60
  /**
@@ -19,11 +66,11 @@ export default class LocaleComponent {
19
66
  translations: any;
20
67
  constructor(components: any, config: any);
21
68
  /**
22
- * Получение экземпляра `moment` с учетом временной зоны бекенда
69
+ * Получение экземпляра `dayjs` с учетом временной зоны бекенда
23
70
  * @param date Дата
24
71
  * @param format Формат
25
72
  */
26
- moment(date?: string, format?: string): moment.Moment;
73
+ dayjs(date?: string, format?: string): dayjs.Dayjs;
27
74
  t(message: any, params?: {}): any;
28
75
  translate(message: any, params?: {}): any;
29
76
  _pasteComponents(message: any, components: any): any;
@@ -26,12 +26,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  exports.__esModule = true;
29
+ /* eslint-disable import/no-extraneous-dependencies */
29
30
  var React = __importStar(require("react"));
30
31
  var intl_messageformat_1 = __importDefault(require("intl-messageformat"));
31
- var moment_1 = __importDefault(require("moment"));
32
+ var dayjs_1 = __importDefault(require("dayjs"));
32
33
  var isObject_1 = __importDefault(require("lodash-es/isObject"));
33
- require("moment/locale/it");
34
- require("moment/locale/ru");
34
+ require("dayjs/locale/it");
35
+ require("dayjs/locale/ru");
35
36
  /**
36
37
  * Locale Component
37
38
  * Компонент для локализации приложения. Поддерживает конфигурацию языка и временной зоны
@@ -56,24 +57,24 @@ var LocaleComponent = /** @class */ (function () {
56
57
  }
57
58
  }
58
59
  /**
59
- * Получение экземпляра `moment` с учетом временной зоны бекенда
60
+ * Получение экземпляра `dayjs` с учетом временной зоны бекенда
60
61
  * @param date Дата
61
62
  * @param format Формат
62
63
  */
63
- LocaleComponent.prototype.moment = function (date, format) {
64
+ LocaleComponent.prototype.dayjs = function (date, format) {
64
65
  if (date === void 0) { date = undefined; }
65
66
  if (format === void 0) { format = undefined; }
66
67
  if (date && this.backendTimeZone) {
67
68
  if (date.length === 16
68
- && (0, moment_1["default"])(date, 'YYYY-MM-DD HH:mm').isValid()) {
69
+ && (0, dayjs_1["default"])(date, 'YYYY-MM-DD HH:mm').isValid()) {
69
70
  date += ':00';
70
71
  }
71
72
  if (date.length === 19
72
- && (0, moment_1["default"])(date, 'YYYY-MM-DD HH:mm:ss').isValid()) {
73
+ && (0, dayjs_1["default"])(date, 'YYYY-MM-DD HH:mm:ss').isValid()) {
73
74
  date += this.backendTimeZone;
74
75
  }
75
76
  }
76
- return (0, moment_1["default"])(date, format).locale(this.language);
77
+ return (0, dayjs_1["default"])(date, format).locale(this.language);
77
78
  };
78
79
  LocaleComponent.prototype.t = function (message, params) {
79
80
  if (params === void 0) { params = {}; }
@@ -53,6 +53,10 @@ var React = __importStar(require("react"));
53
53
  var react_redux_1 = require("react-redux");
54
54
  var merge_1 = __importDefault(require("lodash-es/merge"));
55
55
  var react_1 = require("react");
56
+ var relativeTime_1 = __importDefault(require("dayjs/plugin/relativeTime"));
57
+ var localizedFormat_1 = __importDefault(require("dayjs/plugin/localizedFormat"));
58
+ var dayjs_1 = __importDefault(require("dayjs"));
59
+ var utc_1 = __importDefault(require("dayjs/plugin/utc"));
56
60
  var ThemeProvider_1 = __importDefault(require("../providers/ThemeProvider"));
57
61
  var ClientStorageComponent_1 = __importDefault(require("../components/ClientStorageComponent"));
58
62
  var HtmlComponent_1 = __importDefault(require("../components/HtmlComponent"));
@@ -93,6 +97,10 @@ exports.defaultComponents = {
93
97
  function useApplication(config) {
94
98
  if (config === void 0) { config = {}; }
95
99
  var useGlobal = config.useGlobal !== false;
100
+ //Extending dayjs / day.js with modules that used in steroids
101
+ dayjs_1["default"].extend(relativeTime_1["default"]);
102
+ dayjs_1["default"].extend(localizedFormat_1["default"]);
103
+ dayjs_1["default"].extend(utc_1["default"]);
96
104
  var components = (0, useComponents_1["default"])();
97
105
  if (useGlobal && !process.env.IS_SSR) {
98
106
  components = window.SteroidsComponents || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steroidsjs/core",
3
- "version": "3.0.0-beta.79",
3
+ "version": "3.0.0-beta.80",
4
4
  "description": "",
5
5
  "author": "Vladimir Kozhin <hello@kozhindev.com>",
6
6
  "repository": {
@@ -31,6 +31,7 @@
31
31
  "@splidejs/react-splide": "^0.7.12",
32
32
  "axios": "^0.21.1",
33
33
  "connected-react-router": "^6.9.3",
34
+ "dayjs": "^1.11.9",
34
35
  "domready": "^1.0.8",
35
36
  "dot-prop-immutable": "^2.1.0",
36
37
  "fileup-core": "^1.2.7",
@@ -40,7 +41,6 @@
40
41
  "load-js": "^3.0.3",
41
42
  "lodash": "^4.17.21",
42
43
  "lodash-es": "^4.17.21",
43
- "moment": "^2.29.1",
44
44
  "path-to-regexp": "^1.7.0",
45
45
  "qs": "^6.9.4",
46
46
  "query-string": "^6.14.0",
@@ -1,6 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { PropsWithChildren } from 'react';
3
3
  import { IUiApplicationComponent } from 'src/components/UiComponent';
4
+ import { ILocaleComponent } from 'src/components/LocaleComponent';
5
+ import { IClientStorageComponent } from 'src/components/ClientStorageComponent';
4
6
  import { IResourceComponent } from '../components/ResourceComponent';
5
7
  declare global {
6
8
  interface Window {
@@ -8,10 +10,10 @@ declare global {
8
10
  }
9
11
  }
10
12
  export interface IComponents {
11
- clientStorage?: any;
13
+ clientStorage?: IClientStorageComponent;
12
14
  html?: any;
13
15
  http?: any;
14
- locale?: any;
16
+ locale?: ILocaleComponent;
15
17
  store?: any;
16
18
  ui?: IUiApplicationComponent;
17
19
  resource?: IResourceComponent;
@@ -14,9 +14,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  exports.__esModule = true;
17
+ /* eslint-disable import/no-extraneous-dependencies */
17
18
  var react_1 = require("react");
18
19
  var react_use_1 = require("react-use");
19
- var moment_1 = __importDefault(require("moment"));
20
+ var dayjs_1 = __importDefault(require("dayjs"));
20
21
  var calendar_1 = require("../../../utils/calendar");
21
22
  function useDateInputState(props) {
22
23
  // Get props value
@@ -78,7 +79,7 @@ function useDateInputState(props) {
78
79
  onDisplayValueChange('');
79
80
  }, [onDisplayValueChange]);
80
81
  var onNow = (0, react_1.useCallback)(function () {
81
- onDisplayValueChange((0, moment_1["default"])().format(props.displayFormat));
82
+ onDisplayValueChange((0, dayjs_1["default"])().format(props.displayFormat));
82
83
  }, [onDisplayValueChange, props.displayFormat]);
83
84
  // Display input props
84
85
  var inputProps = (0, react_1.useMemo)(function () { return (__assign({ value: displayValue, onChange: onDisplayValueChange, onFocus: onFocus, onBlur: onBlur, disabled: props.disabled, placeholder: props.placeholder || props.displayFormat.toLowerCase(), required: props.required, name: props.input.name, autoComplete: 'off', type: 'text' }, props.inputProps)); }, [displayValue, onBlur, onDisplayValueChange, onFocus, props.disabled, props.displayFormat,
@@ -3,8 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  exports.__esModule = true;
6
+ /* eslint-disable import/no-extraneous-dependencies */
6
7
  var react_1 = require("react");
7
- var moment_1 = __importDefault(require("moment"));
8
+ var dayjs_1 = __importDefault(require("dayjs"));
8
9
  var calendar_1 = require("../../../utils/calendar");
9
10
  /**
10
11
  * useDateTime
@@ -26,7 +27,7 @@ function useDateTime(props) {
26
27
  // eslint-disable-next-line react-hooks/exhaustive-deps
27
28
  }, [props.dateTimeSeparator, props.input.onChange, props.valueFormat, timeValue]);
28
29
  var onTimeSelect = (0, react_1.useCallback)(function (time) {
29
- var result = (dateValue || (0, moment_1["default"])().format(dateValueFormat)) + props.dateTimeSeparator + time;
30
+ var result = (dateValue || (0, dayjs_1["default"])().format(dateValueFormat)) + props.dateTimeSeparator + time;
30
31
  props.input.onChange.call(null, (0, calendar_1.convertDate)(result, [props.valueFormat, 'YYYY-MM-DD HH:mm'], props.valueFormat,
31
32
  // converting to UTC here depends on whether the date is stored in UTC
32
33
  props.dateInUTC,
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  exports.__esModule = true;
6
+ /* eslint-disable import/no-extraneous-dependencies */
6
7
  var isString_1 = __importDefault(require("lodash-es/isString"));
7
8
  var isInteger_1 = __importDefault(require("lodash-es/isInteger"));
8
9
  var set_1 = __importDefault(require("lodash-es/set"));
@@ -10,7 +11,7 @@ var get_1 = __importDefault(require("lodash-es/get"));
10
11
  var isEmpty_1 = __importDefault(require("lodash-es/isEmpty"));
11
12
  var size_1 = __importDefault(require("lodash-es/size"));
12
13
  var isFunction_1 = __importDefault(require("lodash-es/isFunction"));
13
- var moment_1 = __importDefault(require("moment"));
14
+ var dayjs_1 = __importDefault(require("dayjs"));
14
15
  var validate = function (data, rules) {
15
16
  var errors = {};
16
17
  rules.forEach(function (item) {
@@ -26,7 +27,7 @@ var validate = function (data, rules) {
26
27
  }
27
28
  break;
28
29
  case 'date':
29
- if (value && !(0, moment_1["default"])(value, 'YYYY-MM-DD').isValid()) {
30
+ if (value && !(0, dayjs_1["default"])(value, 'YYYY-MM-DD').isValid()) {
30
31
  errors[attribute] = __('Date wrong format');
31
32
  }
32
33
  break;
@@ -10,7 +10,7 @@ function DateFormatter(props) {
10
10
  return null;
11
11
  }
12
12
  return components.ui.renderView(props.view || 'format.DefaultFormatterView', {
13
- value: components.locale.moment(props.value).format(props.format || defaultProps.format)
13
+ value: components.locale.dayjs(props.value).format(props.format || defaultProps.format)
14
14
  });
15
15
  }
16
16
  exports["default"] = DateFormatter;
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  exports.__esModule = true;
6
- var moment_1 = __importDefault(require("moment"));
6
+ /* eslint-disable import/no-extraneous-dependencies */
7
+ var dayjs_1 = __importDefault(require("dayjs"));
7
8
  var hooks_1 = require("../../../hooks");
8
9
  function DateTimeFormatter(props) {
9
10
  var components = (0, hooks_1.useComponents)();
@@ -11,8 +12,8 @@ function DateTimeFormatter(props) {
11
12
  return null;
12
13
  }
13
14
  var date = props.timeZone === false
14
- ? (0, moment_1["default"])(props.value).locale(components.locale.language)
15
- : components.locale.moment(props.value);
15
+ ? (0, dayjs_1["default"])(props.value).locale(components.locale.language)
16
+ : components.locale.dayjs(props.value);
16
17
  return components.ui.renderView(props.view || 'format.DefaultFormatterView', {
17
18
  value: date.format(props.format)
18
19
  });
@@ -1,4 +1,4 @@
1
- export declare const convertDate: (date: string | Date, fromFormats: string | string[], toFormat?: string, utc?: boolean, dateInUtc?: boolean) => any;
1
+ export declare const convertDate: (date: string | Date, fromFormats: string | string[], toFormat?: string, isUtc?: boolean, dateInUtc?: boolean) => any;
2
2
  /**
3
3
  * Регулярка проверяет соответствие введенной строки формату 'hh:mm'
4
4
  * Максимальная величина - 23:59
package/utils/calendar.js CHANGED
@@ -4,43 +4,43 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  exports.__esModule = true;
6
6
  exports.convertDate = void 0;
7
+ /* eslint-disable import/no-extraneous-dependencies */
7
8
  /* eslint-disable import/prefer-default-export */
8
- var moment_1 = __importDefault(require("moment"));
9
- var convertDate = function (date, fromFormats, toFormat, utc, dateInUtc) {
9
+ var dayjs_1 = __importDefault(require("dayjs"));
10
+ var utc_1 = __importDefault(require("dayjs/plugin/utc"));
11
+ dayjs_1["default"].extend(utc_1["default"]);
12
+ var convertDate = function (date, fromFormats, toFormat, isUtc, dateInUtc) {
10
13
  if (toFormat === void 0) { toFormat = null; }
11
- if (utc === void 0) { utc = false; }
14
+ if (isUtc === void 0) { isUtc = false; }
12
15
  if (dateInUtc === void 0) { dateInUtc = false; }
13
16
  if (!date) {
14
17
  return null;
15
18
  }
16
- var momentDate;
19
+ var dayjsDate;
17
20
  if (typeof date === 'string' && fromFormats) {
18
21
  var validFormat = [].concat(fromFormats || []).find(function (format) { return (date
19
22
  && date.length === format.length
20
- && (0, moment_1["default"])(date, format).isValid()); });
23
+ && (0, dayjs_1["default"])(date, format).isValid()); });
21
24
  if (!validFormat) {
22
25
  return null;
23
26
  }
24
27
  if (dateInUtc) {
25
- momentDate = moment_1["default"].utc(date, validFormat);
28
+ dayjsDate = (0, dayjs_1["default"])(date, validFormat).utc(true);
26
29
  }
27
30
  else {
28
- momentDate = (0, moment_1["default"])(date, validFormat);
31
+ dayjsDate = (0, dayjs_1["default"])(date, validFormat);
29
32
  }
30
33
  }
31
34
  else if (date instanceof Date) {
32
- momentDate = (0, moment_1["default"])(date);
35
+ dayjsDate = (0, dayjs_1["default"])(date);
33
36
  }
34
- if (!momentDate) {
37
+ if (!dayjsDate) {
35
38
  return null;
36
39
  }
37
- if (utc) {
38
- momentDate = momentDate.utc();
40
+ if (isUtc) {
41
+ dayjsDate = dayjsDate.utc();
39
42
  }
40
- else {
41
- momentDate = momentDate.local();
42
- }
43
- return toFormat ? momentDate.format(toFormat) : momentDate.toDate();
43
+ return toFormat ? dayjsDate.format(toFormat) : dayjsDate.toDate();
44
44
  };
45
45
  exports.convertDate = convertDate;
46
46
  /**