@qrvey/utils 1.4.0-4 → 1.4.0-5
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 +1 -1
- package/dist/cjs/column_format/helpers/defineTableChartFormat.js +3 -3
- package/dist/cjs/columns/helpers/getDatasetColumn.js +1 -3
- package/dist/cjs/dates/adapters/mdyDateToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/mdyDateToDate.js +12 -5
- package/dist/cjs/dates/adapters/monthYearToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/monthYearToDate.js +8 -7
- package/dist/cjs/dates/adapters/quarterYearToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/quarterYearToDate.js +8 -7
- package/dist/cjs/dates/adapters/weekYearToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/weekYearToDate.js +20 -19
- package/dist/cjs/dates/adapters/yearToDate.d.ts +1 -1
- package/dist/cjs/dates/adapters/yearToDate.js +7 -6
- package/dist/cjs/dates/constants/DATE_FORMAT_BY_PROPERTY.d.ts +16 -0
- package/dist/cjs/dates/constants/DATE_FORMAT_BY_PROPERTY.js +21 -0
- package/dist/cjs/dates/helpers/getDateFormatByProperty.js +2 -31
- package/dist/cjs/dates/helpers/getDateFormatRegularExpressionInArray.d.ts +2 -1
- package/dist/cjs/dates/helpers/getDateFormatRegularExpressionInArray.js +2 -7
- package/dist/cjs/dates/helpers/getDatePickerPickLevel.js +7 -1
- package/dist/cjs/dates/helpers/getSeparatorByDateFormat.js +1 -18
- package/dist/cjs/dates/helpers/index.d.ts +0 -1
- package/dist/cjs/dates/helpers/index.js +0 -1
- package/dist/cjs/dates/helpers/validateDate.js +14 -3
- package/dist/cjs/dates/range/getDateRange.js +15 -25
- package/dist/cjs/dates/relative/RelativeStatementAdapter.js +15 -10
- package/dist/cjs/dates/relative/helpers/getStatementCase.js +10 -7
- package/dist/cjs/filters/adapters/adaptDateGroupingProperty.js +9 -13
- package/dist/cjs/filters/adapters/logicToUI.js +1 -2
- package/dist/cjs/filters/adapters/transformFilters.js +1 -3
- package/dist/cjs/filters/helpers/OLD_getAggFilters.js +1 -3
- package/dist/cjs/filters/helpers/backend/buildFilters.js +5 -2
- package/dist/cjs/filters/helpers/backend/getBackendGroupValue.js +1 -2
- package/dist/cjs/filters/helpers/backend/getBackendValues.js +53 -31
- package/dist/cjs/filters/helpers/backend/getLogicByDatasetsColumns.d.ts +2 -2
- package/dist/cjs/filters/helpers/backend/getLogicByDatasetsColumns.js +57 -20
- package/dist/cjs/filters/helpers/common/excludeFiltersByParams.js +1 -2
- package/dist/cjs/filters/helpers/common/getFiltersByDatasetsColumns.js +28 -18
- package/dist/cjs/filters/helpers/common/getFiltersByParams.js +1 -2
- package/dist/cjs/filters/helpers/getAggFiltersFromFilterData.js +0 -1
- package/dist/cjs/filters/helpers/getScopesByHierarchy.js +7 -5
- package/dist/cjs/filters/helpers/ui/getUIValues.js +76 -85
- package/dist/cjs/filters/interfaces/functions/IFFGetLogicByDatasetsColumns.d.ts +3 -0
- package/dist/cjs/filters/services/UChartApi.d.ts +17 -3
- package/dist/cjs/filters/services/UChartApi.js +49 -26
- package/dist/cjs/filters/services/UChartPaginationApi.d.ts +17 -3
- package/dist/cjs/filters/services/UChartPaginationApi.js +45 -24
- package/dist/cjs/general/mix/isNaNV2.d.ts +10 -3
- package/dist/cjs/general/mix/isNaNV2.js +11 -4
- package/dist/cjs/general/string/parseUrl.js +2 -2
- package/dist/cjs/globalization/helpers/getI18nCalendar.js +10 -7
- package/dist/cjs/globalization/service/i18nextBuilder.js +1 -3
- package/dist/cjs/globalization/service/initI18n.js +1 -12
- package/dist/cjs/qrvey/helpers/getDataAnswersByColumn.js +6 -5
- package/dist/cjs/qrvey/helpers/getExpressionAnswers.js +15 -11
- package/dist/cjs/tokens/isTokenLabel.js +1 -2
- package/dist/column_format/helpers/defineTableChartFormat.js +3 -3
- package/dist/columns/helpers/getDatasetColumn.js +1 -3
- package/dist/dates/adapters/mdyDateToDate.d.ts +1 -1
- package/dist/dates/adapters/mdyDateToDate.js +12 -5
- package/dist/dates/adapters/monthYearToDate.d.ts +1 -1
- package/dist/dates/adapters/monthYearToDate.js +8 -7
- package/dist/dates/adapters/quarterYearToDate.d.ts +1 -1
- package/dist/dates/adapters/quarterYearToDate.js +8 -7
- package/dist/dates/adapters/weekYearToDate.d.ts +1 -1
- package/dist/dates/adapters/weekYearToDate.js +20 -19
- package/dist/dates/adapters/yearToDate.d.ts +1 -1
- package/dist/dates/adapters/yearToDate.js +7 -6
- package/dist/dates/constants/DATE_FORMAT_BY_PROPERTY.d.ts +16 -0
- package/dist/dates/constants/DATE_FORMAT_BY_PROPERTY.js +18 -0
- package/dist/dates/helpers/getDateFormatByProperty.js +2 -31
- package/dist/dates/helpers/getDateFormatRegularExpressionInArray.d.ts +2 -1
- package/dist/dates/helpers/getDateFormatRegularExpressionInArray.js +2 -7
- package/dist/dates/helpers/getDatePickerPickLevel.js +7 -1
- package/dist/dates/helpers/getSeparatorByDateFormat.js +1 -18
- package/dist/dates/helpers/index.d.ts +0 -1
- package/dist/dates/helpers/index.js +0 -1
- package/dist/dates/helpers/validateDate.js +14 -3
- package/dist/dates/range/getDateRange.js +15 -25
- package/dist/dates/relative/RelativeStatementAdapter.js +15 -10
- package/dist/dates/relative/helpers/getStatementCase.js +10 -7
- package/dist/filters/adapters/adaptDateGroupingProperty.js +9 -13
- package/dist/filters/adapters/logicToUI.js +1 -2
- package/dist/filters/adapters/transformFilters.js +1 -3
- package/dist/filters/helpers/OLD_getAggFilters.js +1 -3
- package/dist/filters/helpers/backend/buildFilters.js +5 -2
- package/dist/filters/helpers/backend/getBackendGroupValue.js +1 -2
- package/dist/filters/helpers/backend/getBackendValues.js +53 -31
- package/dist/filters/helpers/backend/getLogicByDatasetsColumns.d.ts +2 -2
- package/dist/filters/helpers/backend/getLogicByDatasetsColumns.js +56 -19
- package/dist/filters/helpers/common/excludeFiltersByParams.js +1 -2
- package/dist/filters/helpers/common/getFiltersByDatasetsColumns.js +28 -18
- package/dist/filters/helpers/common/getFiltersByParams.js +1 -2
- package/dist/filters/helpers/getAggFiltersFromFilterData.js +0 -1
- package/dist/filters/helpers/getScopesByHierarchy.js +7 -5
- package/dist/filters/helpers/ui/getUIValues.js +76 -85
- package/dist/filters/interfaces/functions/IFFGetLogicByDatasetsColumns.d.ts +3 -0
- package/dist/filters/services/UChartApi.d.ts +17 -3
- package/dist/filters/services/UChartApi.js +49 -26
- package/dist/filters/services/UChartPaginationApi.d.ts +17 -3
- package/dist/filters/services/UChartPaginationApi.js +45 -24
- package/dist/general/mix/isNaNV2.d.ts +10 -3
- package/dist/general/mix/isNaNV2.js +11 -4
- package/dist/general/string/parseUrl.js +2 -2
- package/dist/globalization/helpers/getI18nCalendar.js +10 -7
- package/dist/globalization/service/i18nextBuilder.js +1 -3
- package/dist/globalization/service/initI18n.js +1 -12
- package/dist/qrvey/helpers/getDataAnswersByColumn.js +6 -5
- package/dist/qrvey/helpers/getExpressionAnswers.js +14 -10
- package/dist/tokens/isTokenLabel.js +1 -2
- package/package.json +4 -4
- package/dist/cjs/dates/helpers/validateDateByDateFormat.d.ts +0 -8
- package/dist/cjs/dates/helpers/validateDateByDateFormat.js +0 -27
- package/dist/dates/helpers/validateDateByDateFormat.d.ts +0 -8
- package/dist/dates/helpers/validateDateByDateFormat.js +0 -23
|
@@ -15,12 +15,26 @@ export default class UChartApi {
|
|
|
15
15
|
getChartResult: (config: IFilterConfig, uFilter: IFUFlattenedFilter, filterLogic?: IFBLogic[], chartSettings?: IFUChartSettings, _resetApi?: boolean) => Promise<IFBData>;
|
|
16
16
|
/**
|
|
17
17
|
* Gets request body structure
|
|
18
|
-
* @param uFilter The filter
|
|
19
|
-
* @param filterLogic Additional filter logic to apply in the preview
|
|
20
|
-
* @param chartSettings The settings of the chart. For Aggregate Columns.
|
|
18
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
19
|
+
* @param {IFBLogic[]} filterLogic Additional filter logic to apply in the preview
|
|
20
|
+
* @param {IFUChartSettings} chartSettings The settings of the chart. For Aggregate Columns.
|
|
21
21
|
* @returns the request body structure
|
|
22
22
|
*/
|
|
23
23
|
private _getPreviewRequestBody;
|
|
24
|
+
/**
|
|
25
|
+
* Gets the filter object structure for the searching text
|
|
26
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
27
|
+
* @returns the filter object structure
|
|
28
|
+
*/
|
|
29
|
+
private _getSearchLogic;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the filters from the chart settings
|
|
32
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
33
|
+
* @param {OLD_IFilterData} searchLogic Additional filter object for the searching text
|
|
34
|
+
* @param {IFUChartSettings} chartSettings The settings of the chart. For Aggregate Columns.
|
|
35
|
+
* @returns the filters from the chart settings
|
|
36
|
+
*/
|
|
37
|
+
private _getFilterCharts;
|
|
24
38
|
/**
|
|
25
39
|
* Gets chart body structure
|
|
26
40
|
* @param uFilter The filter Builder filter
|
|
@@ -42,34 +42,14 @@ class UChartApi {
|
|
|
42
42
|
};
|
|
43
43
|
/**
|
|
44
44
|
* Gets request body structure
|
|
45
|
-
* @param uFilter The filter
|
|
46
|
-
* @param filterLogic Additional filter logic to apply in the preview
|
|
47
|
-
* @param chartSettings The settings of the chart. For Aggregate Columns.
|
|
45
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
46
|
+
* @param {IFBLogic[]} filterLogic Additional filter logic to apply in the preview
|
|
47
|
+
* @param {IFUChartSettings} chartSettings The settings of the chart. For Aggregate Columns.
|
|
48
48
|
* @returns the request body structure
|
|
49
49
|
*/
|
|
50
50
|
this._getPreviewRequestBody = (uFilter, filterLogic = [], chartSettings) => {
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
((chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.chart) || []).length;
|
|
54
|
-
let searchLogic;
|
|
55
|
-
if (!(0, isEmpty_1.isEmpty)(uFilter.values)) {
|
|
56
|
-
searchLogic = (0, flatUIToOldLogic_1.flatUIToOldLogic)([
|
|
57
|
-
Object.assign(Object.assign({}, uFilter), { validator: this._getValidationType(column, validator), column: Object.assign(Object.assign({}, uFilter.column), { linkid: undefined }) }),
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
let filterCharts = [];
|
|
61
|
-
if (haveAggFilters) {
|
|
62
|
-
filterCharts = chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.chart.map((chart) => {
|
|
63
|
-
if (uFilter.column.type === COLUMN_1.COLUMN.AGGREGATED_FORMULA)
|
|
64
|
-
return chart;
|
|
65
|
-
const summaryIndex = (chart.summaries || []).findIndex((s) => s.questionid === uFilter.column.id &&
|
|
66
|
-
s.aggregate === uFilter.column.aggregate);
|
|
67
|
-
const summary = summaryIndex !== -1 && chart.summaries[summaryIndex];
|
|
68
|
-
const chartAggFilters = (0, getAggFiltersBySummaryIndex_1.getAggFiltersBySummaryIndex)(chart.aggFilters, summaryIndex);
|
|
69
|
-
const searchAggFilters = (0, OLD_getAggFilters_1.getAggFilters)((searchLogic === null || searchLogic === void 0 ? void 0 : searchLogic.logic) || [], summary ? [summary] : []);
|
|
70
|
-
return Object.assign(Object.assign({}, chart), { aggFilters: searchAggFilters || chartAggFilters, summaries: summary ? [summary] : [] });
|
|
71
|
-
}).filter((chart) => chart.summaries.length);
|
|
72
|
-
}
|
|
51
|
+
const searchLogic = this._getSearchLogic(uFilter);
|
|
52
|
+
const filterCharts = this._getFilterCharts(uFilter, searchLogic, chartSettings);
|
|
73
53
|
const chartsBody = !filterCharts[0]
|
|
74
54
|
? [this._getChartBody(uFilter)]
|
|
75
55
|
: [filterCharts[0]];
|
|
@@ -77,7 +57,11 @@ class UChartApi {
|
|
|
77
57
|
...filterLogic,
|
|
78
58
|
...(!filterCharts[0] ? (searchLogic === null || searchLogic === void 0 ? void 0 : searchLogic.logic) || [] : []),
|
|
79
59
|
];
|
|
80
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
charts: chartsBody,
|
|
62
|
+
logic: filters,
|
|
63
|
+
qrveyid: uFilter.column.qrveyid,
|
|
64
|
+
};
|
|
81
65
|
};
|
|
82
66
|
/**
|
|
83
67
|
* Gets chart body structure
|
|
@@ -273,5 +257,44 @@ class UChartApi {
|
|
|
273
257
|
return validation;
|
|
274
258
|
};
|
|
275
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Gets the filter object structure for the searching text
|
|
262
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
263
|
+
* @returns the filter object structure
|
|
264
|
+
*/
|
|
265
|
+
_getSearchLogic(uFilter) {
|
|
266
|
+
let searchLogic;
|
|
267
|
+
if (!(0, isEmpty_1.isEmpty)(uFilter.values)) {
|
|
268
|
+
searchLogic = (0, flatUIToOldLogic_1.flatUIToOldLogic)([
|
|
269
|
+
Object.assign(Object.assign({}, uFilter), { validator: this._getValidationType(uFilter.column, uFilter.validator), column: Object.assign(Object.assign({}, uFilter.column), { linkid: undefined }) }),
|
|
270
|
+
]);
|
|
271
|
+
}
|
|
272
|
+
return searchLogic;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Gets the filters from the chart settings
|
|
276
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
277
|
+
* @param {OLD_IFilterData} searchLogic Additional filter object for the searching text
|
|
278
|
+
* @param {IFUChartSettings} chartSettings The settings of the chart. For Aggregate Columns.
|
|
279
|
+
* @returns the filters from the chart settings
|
|
280
|
+
*/
|
|
281
|
+
_getFilterCharts(uFilter, searchLogic, chartSettings) {
|
|
282
|
+
let filterCharts = [];
|
|
283
|
+
const haveAggFilters = ((chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.aggregateColumns) || []).length &&
|
|
284
|
+
((chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.chart) || []).length;
|
|
285
|
+
if (haveAggFilters) {
|
|
286
|
+
filterCharts = chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.chart.map((chart) => {
|
|
287
|
+
if (uFilter.column.type === COLUMN_1.COLUMN.AGGREGATED_FORMULA)
|
|
288
|
+
return chart;
|
|
289
|
+
const summaryIndex = (chart.summaries || []).findIndex((s) => s.questionid === uFilter.column.id &&
|
|
290
|
+
s.aggregate === uFilter.column.aggregate);
|
|
291
|
+
const summary = summaryIndex !== -1 && chart.summaries[summaryIndex];
|
|
292
|
+
const chartAggFilters = (0, getAggFiltersBySummaryIndex_1.getAggFiltersBySummaryIndex)(chart.aggFilters, summaryIndex);
|
|
293
|
+
const searchAggFilters = (0, OLD_getAggFilters_1.getAggFilters)((searchLogic === null || searchLogic === void 0 ? void 0 : searchLogic.logic) || [], summary ? [summary] : []);
|
|
294
|
+
return Object.assign(Object.assign({}, chart), { aggFilters: searchAggFilters || chartAggFilters, summaries: summary ? [summary] : [] });
|
|
295
|
+
}).filter((chart) => chart.summaries.length);
|
|
296
|
+
}
|
|
297
|
+
return filterCharts;
|
|
298
|
+
}
|
|
276
299
|
}
|
|
277
300
|
exports.default = UChartApi;
|
|
@@ -23,12 +23,26 @@ export default class UChartPaginationApi {
|
|
|
23
23
|
getChartResult: (config: IFilterConfig, uFilter: IFUFlattenedFilter, filterLogic?: IFBLogic[], chartSettings?: IFUChartSettings, resetApi?: boolean) => Promise<IFBData>;
|
|
24
24
|
/**
|
|
25
25
|
* Gets request body structure
|
|
26
|
-
* @param uFilter The filter
|
|
27
|
-
* @param filterLogic Additional filter logic to apply in the preview
|
|
28
|
-
* @param chartSettings The settings of the chart. For Aggregate Columns.
|
|
26
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
27
|
+
* @param {IFBLogic[]} filterLogic Additional filter logic to apply in the preview
|
|
28
|
+
* @param {IFUChartSettings} chartSettings The settings of the chart. For Aggregate Columns.
|
|
29
29
|
* @returns the request body structure
|
|
30
30
|
*/
|
|
31
31
|
private _getPreviewRequestBody;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the filter object structure for the searching text
|
|
34
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
35
|
+
* @returns the filter object structure
|
|
36
|
+
*/
|
|
37
|
+
private _getSearchLogic;
|
|
38
|
+
/**
|
|
39
|
+
* Gets the filters from the chart settings
|
|
40
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
41
|
+
* @param {OLD_IFilterData} searchLogic Additional filter object for the searching text
|
|
42
|
+
* @param {IFUChartSettings} chartSettings The settings of the chart. For Aggregate Columns.
|
|
43
|
+
* @returns the filters from the chart settings
|
|
44
|
+
*/
|
|
45
|
+
private _getFilterCharts;
|
|
32
46
|
/**
|
|
33
47
|
* Gets dimension body structure
|
|
34
48
|
* @param uFilter The filter Builder filter
|
|
@@ -52,39 +52,21 @@ class UChartPaginationApi {
|
|
|
52
52
|
};
|
|
53
53
|
/**
|
|
54
54
|
* Gets request body structure
|
|
55
|
-
* @param uFilter The filter
|
|
56
|
-
* @param filterLogic Additional filter logic to apply in the preview
|
|
57
|
-
* @param chartSettings The settings of the chart. For Aggregate Columns.
|
|
55
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
56
|
+
* @param {IFBLogic[]} filterLogic Additional filter logic to apply in the preview
|
|
57
|
+
* @param {IFUChartSettings} chartSettings The settings of the chart. For Aggregate Columns.
|
|
58
58
|
* @returns the request body structure
|
|
59
59
|
*/
|
|
60
60
|
this._getPreviewRequestBody = (uFilter, filterLogic = [], chartSettings, afterKey) => {
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
((chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.chart) || []).length;
|
|
64
|
-
let searchLogic;
|
|
65
|
-
if (!(0, isEmpty_1.isEmpty)(uFilter.values)) {
|
|
66
|
-
searchLogic = (0, flatUIToOldLogic_1.flatUIToOldLogic)([
|
|
67
|
-
Object.assign(Object.assign({}, uFilter), { validator: this._getValidationType(column, validator), column: Object.assign(Object.assign({}, uFilter.column), { linkid: undefined }) }),
|
|
68
|
-
]);
|
|
69
|
-
}
|
|
70
|
-
let filterCharts = [];
|
|
71
|
-
if (haveAggFilters) {
|
|
72
|
-
filterCharts = chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.chart.map((chart) => {
|
|
73
|
-
const summaryIndex = (chart.summaries || []).findIndex((s) => s.questionid === uFilter.column.id &&
|
|
74
|
-
s.aggregate === uFilter.column.aggregate);
|
|
75
|
-
const summary = summaryIndex !== -1 && chart.summaries[summaryIndex];
|
|
76
|
-
const chartAggFilters = (0, getAggFiltersBySummaryIndex_1.getAggFiltersBySummaryIndex)(chart.aggFilters, summaryIndex);
|
|
77
|
-
const searchAggFilters = (0, OLD_getAggFilters_1.getAggFilters)((searchLogic === null || searchLogic === void 0 ? void 0 : searchLogic.logic) || [], summary ? [summary] : []);
|
|
78
|
-
return Object.assign(Object.assign({}, chart), { aggFilters: searchAggFilters || chartAggFilters, summaries: summary ? [summary] : [] });
|
|
79
|
-
}).filter((chart) => chart.summaries.length);
|
|
80
|
-
}
|
|
61
|
+
const searchLogic = this._getSearchLogic(uFilter);
|
|
62
|
+
const filterCharts = this._getFilterCharts(uFilter, searchLogic, chartSettings);
|
|
81
63
|
const dimensions = !filterCharts[0]
|
|
82
64
|
? this._getDimensionsBody(uFilter)
|
|
83
65
|
: this._getDimensionsBodyAdapter(filterCharts[0].dimensions);
|
|
84
66
|
const summaries = !filterCharts[0]
|
|
85
67
|
? this._getSummariesBody(uFilter)
|
|
86
68
|
: filterCharts[0].summaries;
|
|
87
|
-
const maxDataPoints = this._getMaxDataPoints(column, chartSettings);
|
|
69
|
+
const maxDataPoints = this._getMaxDataPoints(uFilter.column, chartSettings);
|
|
88
70
|
const filters = [
|
|
89
71
|
...filterLogic,
|
|
90
72
|
...(!filterCharts[0] ? (searchLogic === null || searchLogic === void 0 ? void 0 : searchLogic.logic) || [] : []),
|
|
@@ -315,5 +297,44 @@ class UChartPaginationApi {
|
|
|
315
297
|
return (0, isEmpty_1.isEmpty)(result);
|
|
316
298
|
};
|
|
317
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Gets the filter object structure for the searching text
|
|
302
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
303
|
+
* @returns the filter object structure
|
|
304
|
+
*/
|
|
305
|
+
_getSearchLogic(uFilter) {
|
|
306
|
+
let searchLogic;
|
|
307
|
+
if (!(0, isEmpty_1.isEmpty)(uFilter.values)) {
|
|
308
|
+
searchLogic = (0, flatUIToOldLogic_1.flatUIToOldLogic)([
|
|
309
|
+
Object.assign(Object.assign({}, uFilter), { validator: this._getValidationType(uFilter.column, uFilter.validator), column: Object.assign(Object.assign({}, uFilter.column), { linkid: undefined }) }),
|
|
310
|
+
]);
|
|
311
|
+
}
|
|
312
|
+
return searchLogic;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Gets the filters from the chart settings
|
|
316
|
+
* @param {IFUFlattenedFilter} uFilter The filter object
|
|
317
|
+
* @param {OLD_IFilterData} searchLogic Additional filter object for the searching text
|
|
318
|
+
* @param {IFUChartSettings} chartSettings The settings of the chart. For Aggregate Columns.
|
|
319
|
+
* @returns the filters from the chart settings
|
|
320
|
+
*/
|
|
321
|
+
_getFilterCharts(uFilter, searchLogic, chartSettings) {
|
|
322
|
+
let filterCharts = [];
|
|
323
|
+
const haveAggFilters = ((chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.aggregateColumns) || []).length &&
|
|
324
|
+
((chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.chart) || []).length;
|
|
325
|
+
if (haveAggFilters) {
|
|
326
|
+
filterCharts = chartSettings === null || chartSettings === void 0 ? void 0 : chartSettings.chart.map((chart) => {
|
|
327
|
+
if (uFilter.column.type === COLUMN_1.COLUMN.AGGREGATED_FORMULA)
|
|
328
|
+
return chart;
|
|
329
|
+
const summaryIndex = (chart.summaries || []).findIndex((s) => s.questionid === uFilter.column.id &&
|
|
330
|
+
s.aggregate === uFilter.column.aggregate);
|
|
331
|
+
const summary = summaryIndex !== -1 && chart.summaries[summaryIndex];
|
|
332
|
+
const chartAggFilters = (0, getAggFiltersBySummaryIndex_1.getAggFiltersBySummaryIndex)(chart.aggFilters, summaryIndex);
|
|
333
|
+
const searchAggFilters = (0, OLD_getAggFilters_1.getAggFilters)((searchLogic === null || searchLogic === void 0 ? void 0 : searchLogic.logic) || [], summary ? [summary] : []);
|
|
334
|
+
return Object.assign(Object.assign({}, chart), { aggFilters: searchAggFilters || chartAggFilters, summaries: summary ? [summary] : [] });
|
|
335
|
+
}).filter((chart) => chart.summaries.length);
|
|
336
|
+
}
|
|
337
|
+
return filterCharts;
|
|
338
|
+
}
|
|
318
339
|
}
|
|
319
340
|
exports.default = UChartPaginationApi;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Validates if the recieved number is NaN type.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Conditions:
|
|
5
|
+
* - This function recieves any variable but will return true if it is different to number.
|
|
6
|
+
* - Empty variables as undefined, null, empty string will return true.
|
|
7
|
+
*
|
|
8
|
+
* Special case for isNaN
|
|
9
|
+
* - The isNaN('') is considered as false statement. The empty string is converted to 0 which is not NaN.
|
|
10
|
+
* - Boolean variables is considered as false statement.
|
|
11
|
+
*
|
|
5
12
|
* @param variable the variable to validate
|
|
6
|
-
* @return True
|
|
13
|
+
* @return True: variable is a NaN; False: The variable is a number
|
|
7
14
|
*/
|
|
8
15
|
export declare function isNaNV2(variable: any): boolean;
|
|
@@ -4,12 +4,19 @@ exports.isNaNV2 = void 0;
|
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
/**
|
|
6
6
|
* Validates if the recieved number is NaN type.
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
*
|
|
8
|
+
* Conditions:
|
|
9
|
+
* - This function recieves any variable but will return true if it is different to number.
|
|
10
|
+
* - Empty variables as undefined, null, empty string will return true.
|
|
11
|
+
*
|
|
12
|
+
* Special case for isNaN
|
|
13
|
+
* - The isNaN('') is considered as false statement. The empty string is converted to 0 which is not NaN.
|
|
14
|
+
* - Boolean variables is considered as false statement.
|
|
15
|
+
*
|
|
9
16
|
* @param variable the variable to validate
|
|
10
|
-
* @return True
|
|
17
|
+
* @return True: variable is a NaN; False: The variable is a number
|
|
11
18
|
*/
|
|
12
19
|
function isNaNV2(variable) {
|
|
13
|
-
return (0, _1.isEmpty)(variable) || isNaN(variable);
|
|
20
|
+
return (0, _1.isEmpty)(variable) || typeof variable == "boolean" || isNaN(variable);
|
|
14
21
|
}
|
|
15
22
|
exports.isNaNV2 = isNaNV2;
|
|
@@ -11,9 +11,9 @@ const parseUrl = (url, transformer) => {
|
|
|
11
11
|
if (!match)
|
|
12
12
|
return url;
|
|
13
13
|
return match.reduce((newUrl, curr) => {
|
|
14
|
-
const key = curr.
|
|
14
|
+
const key = curr.substring(2);
|
|
15
15
|
const value = typeof transformer === "function" ? transformer(key) : transformer[key];
|
|
16
|
-
return newUrl.replace(curr.
|
|
16
|
+
return newUrl.replace(curr.substring(1), value);
|
|
17
17
|
}, url);
|
|
18
18
|
};
|
|
19
19
|
exports.parseUrl = parseUrl;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getI18nCalendar = void 0;
|
|
4
|
+
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
4
5
|
const i18nextBuilder_1 = require("../service/i18nextBuilder");
|
|
5
6
|
function getI18nCalendar(locale) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
let localeOverride;
|
|
8
|
+
if (locale instanceof i18nextBuilder_1.I18nService) {
|
|
9
|
+
localeOverride = locale;
|
|
10
|
+
}
|
|
11
|
+
else if (typeof locale === "function") {
|
|
12
|
+
localeOverride = { translate: locale };
|
|
13
|
+
}
|
|
14
|
+
if ((0, isEmpty_1.isEmpty)(localeOverride))
|
|
15
|
+
return;
|
|
13
16
|
return {
|
|
14
17
|
clear: localeOverride.translate("common.calendar.clear"),
|
|
15
18
|
days: [
|
|
@@ -17,9 +17,7 @@ const i18next_1 = __importDefault(require("i18next"));
|
|
|
17
17
|
const mergeDeep_1 = require("../../general/object/mergeDeep");
|
|
18
18
|
class I18nServiceBuilder {
|
|
19
19
|
static buildI18n(i18nDefault, i18nResource) {
|
|
20
|
-
return
|
|
21
|
-
return yield this._initI18n(i18nDefault, i18nResource);
|
|
22
|
-
});
|
|
20
|
+
return this._initI18n(i18nDefault, i18nResource);
|
|
23
21
|
}
|
|
24
22
|
static _initI18n(i18nDefault, i18nResource) {
|
|
25
23
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.initI18n = void 0;
|
|
13
4
|
const i18nextBuilder_1 = require("../service/i18nextBuilder");
|
|
14
5
|
function initI18n(i18nConfig = {}, i18nDefault = {}) {
|
|
15
|
-
return
|
|
16
|
-
return yield i18nextBuilder_1.I18nServiceBuilder.buildI18n(i18nDefault, i18nConfig);
|
|
17
|
-
});
|
|
6
|
+
return i18nextBuilder_1.I18nServiceBuilder.buildI18n(i18nDefault, i18nConfig);
|
|
18
7
|
}
|
|
19
8
|
exports.initI18n = initI18n;
|
|
@@ -50,9 +50,10 @@ function getDataAnswersByColumn(settings) {
|
|
|
50
50
|
}
|
|
51
51
|
exports.getDataAnswersByColumn = getDataAnswersByColumn;
|
|
52
52
|
function getColumnFromData(settings) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
if (!(0, isEmpty_1.isEmpty)(settings.dataset)) {
|
|
54
|
+
return (0, getDatasetColumn_1.getDatasetColumn)(settings.column, settings.dataset);
|
|
55
|
+
}
|
|
56
|
+
else if (!(0, isEmpty_1.isEmpty)(settings.model)) {
|
|
57
|
+
return (0, getModelColumn_1.getModelColumn)(settings.column, settings.model);
|
|
58
|
+
}
|
|
58
59
|
}
|
|
@@ -12,17 +12,21 @@ const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
|
12
12
|
function getExpressionAnswers(column, property) {
|
|
13
13
|
if ((0, isEmpty_1.isEmpty)(column))
|
|
14
14
|
return [];
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
const categoryExpressions = column.expressionCategory
|
|
16
|
+
? getCategoryAnswers(column, property)
|
|
17
|
+
: column.expressionWords;
|
|
18
|
+
return (categoryExpressions || []).map((word) => ({
|
|
19
|
+
answer: word.text,
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
exports.getExpressionAnswers = getExpressionAnswers;
|
|
23
|
+
function getCategoryAnswers(column, property) {
|
|
24
|
+
let categoryExpressions;
|
|
25
|
+
if (COMPLEX_COLUMN_PROPERTY_1.COMPLEX_COLUMN_PROPERTY.EXPRESSION_NEGATIVE === property) {
|
|
26
|
+
categoryExpressions = column.expressionNegative;
|
|
21
27
|
}
|
|
22
|
-
else {
|
|
23
|
-
|
|
24
|
-
answer: word.text,
|
|
25
|
-
}));
|
|
28
|
+
else if (COMPLEX_COLUMN_PROPERTY_1.COMPLEX_COLUMN_PROPERTY.EXPRESSION_POSITIVE === property) {
|
|
29
|
+
categoryExpressions = column.expressionPositive;
|
|
26
30
|
}
|
|
31
|
+
return categoryExpressions;
|
|
27
32
|
}
|
|
28
|
-
exports.getExpressionAnswers = getExpressionAnswers;
|
|
@@ -10,7 +10,6 @@ const isEmpty_1 = require("../general/mix/isEmpty");
|
|
|
10
10
|
function isTokenLabel(label = "") {
|
|
11
11
|
if ((0, isEmpty_1.isEmpty)(label) || typeof label !== "string")
|
|
12
12
|
return false;
|
|
13
|
-
|
|
14
|
-
return regex.test(label);
|
|
13
|
+
return /^\{\{([^{\s}]+)\}\}$/g.test(label);
|
|
15
14
|
}
|
|
16
15
|
exports.isTokenLabel = isTokenLabel;
|
|
@@ -38,8 +38,8 @@ export const defineTableChartFormat = (column, settings) => {
|
|
|
38
38
|
return STRING_FORMAT.NONE;
|
|
39
39
|
}
|
|
40
40
|
else if (hasDefaultFormat) {
|
|
41
|
-
const columnDefaultFormat = defaultFormat || outputFormat;
|
|
42
|
-
return Object.assign(Object.assign({}, defaultFormat), { format: defaultText, originalFormat: Object.assign({}, columnDefaultFormat) });
|
|
41
|
+
const columnDefaultFormat = defaultFormat || outputFormat || { type: 'DATE', format: 'MM/DD/YYYY' };
|
|
42
|
+
return Object.assign(Object.assign({}, defaultFormat), { format: defaultText, originalFormat: Object.assign({}, columnDefaultFormat), type: "DATE" });
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
45
|
return selectedFormat;
|
|
@@ -52,7 +52,7 @@ export const defineTableChartFormat = (column, settings) => {
|
|
|
52
52
|
if ((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.COUNT ||
|
|
53
53
|
(aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.DISTINCTCOUNT)
|
|
54
54
|
return defaultNumeric;
|
|
55
|
-
return defaultFormat;
|
|
55
|
+
return defaultFormat || defaultNumeric;
|
|
56
56
|
}
|
|
57
57
|
return selectedFormat;
|
|
58
58
|
}
|
|
@@ -3,9 +3,7 @@ export function getDatasetColumn(column, dataset) {
|
|
|
3
3
|
if (isEmpty(column) || isEmpty(dataset))
|
|
4
4
|
return;
|
|
5
5
|
const columns = getDatasetColumns(dataset);
|
|
6
|
-
|
|
7
|
-
return;
|
|
8
|
-
return columns.find((c) => c.id === column.id);
|
|
6
|
+
return columns.find((c) => c.id === column.id && c.qrveyid === column.qrveyid);
|
|
9
7
|
}
|
|
10
8
|
function getDatasetColumns(dataset) {
|
|
11
9
|
return (dataset === null || dataset === void 0 ? void 0 : dataset.options) || [];
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Transforms String Date from a [mm/dd/yyyy] format to Date object.
|
|
3
3
|
* @param monthYearDate String of [mm/dd/yyyy] date
|
|
4
4
|
* @param time Flag to parse the object date to milliseconds.
|
|
5
|
-
* @returns The date object or the date in milliseconds
|
|
5
|
+
* @returns The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value
|
|
6
6
|
*/
|
|
7
7
|
export declare function mdyDateToDate(date: string, time?: boolean): string | Date | number;
|
|
@@ -6,12 +6,19 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
6
6
|
* Transforms String Date from a [mm/dd/yyyy] format to Date object.
|
|
7
7
|
* @param monthYearDate String of [mm/dd/yyyy] date
|
|
8
8
|
* @param time Flag to parse the object date to milliseconds.
|
|
9
|
-
* @returns The date object or the date in milliseconds
|
|
9
|
+
* @returns The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value
|
|
10
10
|
*/
|
|
11
11
|
export function mdyDateToDate(date, time = false) {
|
|
12
|
-
if (isEmpty(date) ||
|
|
12
|
+
if (isEmpty(date) ||
|
|
13
|
+
isTokenLabel(date) ||
|
|
14
|
+
typeof date !== "string" ||
|
|
15
|
+
!validatingDate(date))
|
|
13
16
|
return date;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
return time ? +new Date(date) : new Date(date);
|
|
18
|
+
}
|
|
19
|
+
function validatingDate(date) {
|
|
20
|
+
return (validateDate(date, DATE_FORMAT.DAY) ||
|
|
21
|
+
validateDate(date, DATE_FORMAT.HOUR) ||
|
|
22
|
+
validateDate(date, DATE_FORMAT.MINUTE) ||
|
|
23
|
+
validateDate(date, DATE_FORMAT.SECOND));
|
|
17
24
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Transforms String Date from a [Month Year] format to Date object.
|
|
3
3
|
* @param monthYearDate String of [Month Year] date
|
|
4
4
|
* @param time Flag to parse the object date to milliseconds.
|
|
5
|
-
* @returns The date object or the date in milliseconds
|
|
5
|
+
* @returns The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value
|
|
6
6
|
*/
|
|
7
7
|
export declare function monthYearToDate(monthYearDate: string, time?: boolean): string | Date | number;
|
|
@@ -7,14 +7,15 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
7
7
|
* Transforms String Date from a [Month Year] format to Date object.
|
|
8
8
|
* @param monthYearDate String of [Month Year] date
|
|
9
9
|
* @param time Flag to parse the object date to milliseconds.
|
|
10
|
-
* @returns The date object or the date in milliseconds
|
|
10
|
+
* @returns The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value
|
|
11
11
|
*/
|
|
12
12
|
export function monthYearToDate(monthYearDate, time = false) {
|
|
13
|
-
if (isEmpty(monthYearDate) ||
|
|
13
|
+
if (isEmpty(monthYearDate) ||
|
|
14
|
+
isTokenLabel(monthYearDate) ||
|
|
15
|
+
typeof monthYearDate !== "string" ||
|
|
16
|
+
!validateDate(monthYearDate, DATE_FORMAT.MONTH))
|
|
14
17
|
return monthYearDate;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return time ? +start : start;
|
|
19
|
-
}
|
|
18
|
+
const [month, year] = monthYearDate.split(" ");
|
|
19
|
+
const start = new Date(+year, DATE_YEAR_MONTHS.indexOf(month), 1);
|
|
20
|
+
return time ? +start : start;
|
|
20
21
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Transforms String Date from a [Quarter Year] format to Date object.
|
|
3
3
|
* @param quarterYearDate String of [Quarter Year] date
|
|
4
4
|
* @param time Flag to parse the object date to milliseconds.
|
|
5
|
-
* @returns The date object or the date in milliseconds
|
|
5
|
+
* @returns The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.
|
|
6
6
|
*/
|
|
7
7
|
export declare function quarterYearToDate(quarterYearDate: string, time?: boolean): string | Date | number;
|
|
@@ -7,14 +7,15 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
7
7
|
* Transforms String Date from a [Quarter Year] format to Date object.
|
|
8
8
|
* @param quarterYearDate String of [Quarter Year] date
|
|
9
9
|
* @param time Flag to parse the object date to milliseconds.
|
|
10
|
-
* @returns The date object or the date in milliseconds
|
|
10
|
+
* @returns The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.
|
|
11
11
|
*/
|
|
12
12
|
export function quarterYearToDate(quarterYearDate, time = false) {
|
|
13
|
-
if (isEmpty(quarterYearDate) ||
|
|
13
|
+
if (isEmpty(quarterYearDate) ||
|
|
14
|
+
isTokenLabel(quarterYearDate) ||
|
|
15
|
+
typeof quarterYearDate !== "string" ||
|
|
16
|
+
!validateDate(quarterYearDate, DATE_FORMAT.QUARTER))
|
|
14
17
|
return quarterYearDate;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return time ? +start : start;
|
|
19
|
-
}
|
|
18
|
+
const [quarter, year] = quarterYearDate.split(" ");
|
|
19
|
+
const start = new Date(+year, DATE_YEAR_QUARTERS_RANGE[quarter].initial, 1);
|
|
20
|
+
return time ? +start : start;
|
|
20
21
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Transforms String Date from a [Week Year] format to Date object.
|
|
3
3
|
* @param date String of [Week Year] date
|
|
4
4
|
* @param time Flag to parse the object date to milliseconds.
|
|
5
|
-
* @returns The date object or the date in milliseconds
|
|
5
|
+
* @returns The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.
|
|
6
6
|
*/
|
|
7
7
|
export declare function weekYearToDate(weekYear: string, time?: boolean): string | Date | number;
|
|
@@ -7,26 +7,27 @@ import { validateDate } from "../helpers/validateDate";
|
|
|
7
7
|
* Transforms String Date from a [Week Year] format to Date object.
|
|
8
8
|
* @param date String of [Week Year] date
|
|
9
9
|
* @param time Flag to parse the object date to milliseconds.
|
|
10
|
-
* @returns The date object or the date in milliseconds
|
|
10
|
+
* @returns The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.
|
|
11
11
|
*/
|
|
12
12
|
export function weekYearToDate(weekYear, time = false) {
|
|
13
|
-
if (isEmpty(weekYear) ||
|
|
13
|
+
if (isEmpty(weekYear) ||
|
|
14
|
+
isTokenLabel(weekYear) ||
|
|
15
|
+
typeof weekYear !== "string" ||
|
|
16
|
+
!validateDate(weekYear, DATE_FORMAT.WEEK))
|
|
14
17
|
return weekYear;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return time ? +date : date;
|
|
31
|
-
}
|
|
18
|
+
const [week, year] = weekYear.split(" ");
|
|
19
|
+
const weekNumber = Number(week.substring(1));
|
|
20
|
+
const dateObj = new Date(+year, 1, 1);
|
|
21
|
+
const numOfdaysPastSinceLastSunday = dateObj.getDay();
|
|
22
|
+
dateObj.setDate(dateObj.getDate() - numOfdaysPastSinceLastSunday);
|
|
23
|
+
const weekNoToday = getWeek(dateObj).week;
|
|
24
|
+
const weeksInTheFuture = weekNumber - weekNoToday;
|
|
25
|
+
dateObj.setDate(dateObj.getDate() + 7 * weeksInTheFuture);
|
|
26
|
+
const date = new Date(dateObj.getMonth() +
|
|
27
|
+
1 +
|
|
28
|
+
"/" +
|
|
29
|
+
dateObj.getDate() +
|
|
30
|
+
"/" +
|
|
31
|
+
dateObj.getFullYear());
|
|
32
|
+
return time ? +date : date;
|
|
32
33
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Transforms String Date from a [Year] format to Date object.
|
|
3
3
|
* @param yearDate String of [Year] date
|
|
4
4
|
* @param time Flag to parse the object date to milliseconds.
|
|
5
|
-
* @returns The date object or the date in milliseconds
|
|
5
|
+
* @returns The date object or the date in milliseconds. If the argument is an unexpected date, the function will return the same value.
|
|
6
6
|
*/
|
|
7
7
|
export declare function yearToDate(yearDate: string, time?: boolean): string | Date | number;
|