@pega/custom-dx-components 0.23.29 → 0.23.31
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/package.json +1 -1
- package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/DateTime/date-utils.js.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/date.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/embed-utils.js.mustache +0 -3
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/repeat-utils.js.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/textformat-utils.jsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/textformat-utils.jsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.jsx.mustache +0 -1
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +1 -2
- package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/Avatar.tsx.mustache +1 -1
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/Avatar.tsx.mustache +1 -1
- package/src/tasks/init/template/.eslintrc.json +13 -1
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/src/tasks/init/template/tsconfig.json +2 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyAutocomplete/date.js +0 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyAutocomplete/embed-utils.js +22 -14
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyAutocomplete/repeat-utils.js +0 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyAutocomplete/textformat-utils.jsx +0 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/DateFormatter.js +0 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/FormattedText.jsx +0 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/date.js +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/date-time.js +0 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/date-utils.js +41 -49
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/date.js +54 -69
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/utils.js +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/utils.js +12 -11
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/Avatar.tsx +1 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/textformat-utils.jsx +0 -1
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/time-of-day.js +41 -48
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/utils.js +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/text-url.jsx +0 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyAutocomplete/date.js +0 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyAutocomplete/embed-utils.js +22 -14
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyAutocomplete/repeat-utils.js +0 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyAutocomplete/textformat-utils.jsx +0 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/DateFormatter.js +0 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/FormattedText.jsx +0 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/date.js +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/date-time.js +0 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/date-utils.js +41 -49
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/date.js +54 -69
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/utils.js +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/utils.js +12 -11
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/Avatar.tsx +1 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/textformat-utils.jsx +0 -1
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/time-of-day.js +41 -48
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/utils.js +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/text-url.jsx +0 -1
package/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable no-undef */import dayjs from "dayjs";
|
|
1
|
+
import dayjs from "dayjs";
|
|
3
2
|
import relativeTime from 'dayjs/plugin/relativeTime.js';
|
|
4
3
|
import localizedFormat from 'dayjs/plugin/localizedFormat.js';
|
|
5
4
|
import utc from 'dayjs/plugin/utc.js';
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
"project": "tsconfig.json",
|
|
6
6
|
"ecmaVersion": 13
|
|
7
7
|
},
|
|
8
|
+
"globals": {
|
|
9
|
+
"PCore": "readonly"
|
|
10
|
+
},
|
|
8
11
|
"settings": {
|
|
9
12
|
"import/resolver": {
|
|
10
13
|
"typescript": {},
|
|
@@ -16,7 +19,14 @@
|
|
|
16
19
|
"version": "detect"
|
|
17
20
|
}
|
|
18
21
|
},
|
|
19
|
-
"ignorePatterns": [
|
|
22
|
+
"ignorePatterns": [
|
|
23
|
+
"node_modules",
|
|
24
|
+
"packages/*/lib",
|
|
25
|
+
"!.storybook",
|
|
26
|
+
".storybook/public",
|
|
27
|
+
"**/demo.stories.jsx",
|
|
28
|
+
"/**/mock.stories.js"
|
|
29
|
+
],
|
|
20
30
|
"rules": {
|
|
21
31
|
// Prettier recommends running separately from a linter.
|
|
22
32
|
// https://prettier.io/docs/en/integrating-with-linters.html#notes
|
|
@@ -82,6 +92,7 @@
|
|
|
82
92
|
"no-irregular-whitespace": "off",
|
|
83
93
|
"no-empty": "off",
|
|
84
94
|
"no-new-object": "off",
|
|
95
|
+
"import/no-relative-packages": "off",
|
|
85
96
|
|
|
86
97
|
"import/no-mutable-exports": "error",
|
|
87
98
|
"sonarjs/max-switch-cases": "error",
|
|
@@ -128,6 +139,7 @@
|
|
|
128
139
|
"operator-assignment": "error",
|
|
129
140
|
"prefer-template": "error",
|
|
130
141
|
"vars-on-top": "error",
|
|
142
|
+
"prefer-regex-literals": "off",
|
|
131
143
|
|
|
132
144
|
"no-use-before-define": "off", // doc for @typescript-eslint/no-use-before-define says to turn off the base implementation
|
|
133
145
|
"@typescript-eslint/no-use-before-define": "error"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@pega/configs": "^0.6.0",
|
|
72
|
-
"@pega/custom-dx-components": "0.23.
|
|
72
|
+
"@pega/custom-dx-components": "0.23.31",
|
|
73
73
|
"@pega/pcore-pconnect-typedefs": "2.0.0",
|
|
74
74
|
"@storybook/addon-actions": "^7.6.7",
|
|
75
75
|
"@storybook/addon-essentials": "^7.6.7",
|
package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyAutocomplete/embed-utils.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
isEmbeddedField,
|
|
3
|
+
isPageListInPath,
|
|
4
|
+
PAGE,
|
|
5
|
+
PAGELIST,
|
|
6
|
+
buildAggOrCalcId
|
|
7
|
+
} from './repeat-utils.js';
|
|
5
8
|
|
|
6
9
|
export const AT_FILTEREDLIST = '@FILTERED_LIST';
|
|
7
10
|
export const AT_PROPERTY = '@P';
|
|
@@ -55,7 +58,7 @@ export function getEmbeddedFieldName(propertyName, classID) {
|
|
|
55
58
|
* @param {Array} metaFields Fields metadata Array. Contains metadata of all the fields.
|
|
56
59
|
*/
|
|
57
60
|
export function updateMetaEmbeddedFieldID(metaFields) {
|
|
58
|
-
return metaFields.forEach(
|
|
61
|
+
return metaFields.forEach(metaField => {
|
|
59
62
|
if (metaField.fieldID?.startsWith(PAGE) || metaField.fieldID?.startsWith(PAGELIST)) {
|
|
60
63
|
metaField.fieldID = getFieldNameFromEmbeddedFieldName(metaField.fieldID);
|
|
61
64
|
}
|
|
@@ -72,7 +75,7 @@ export function updateMetaEmbeddedFieldID(metaFields) {
|
|
|
72
75
|
*/
|
|
73
76
|
export function getConfigEmbeddedFieldsMeta(configFields, classID) {
|
|
74
77
|
const configEmbeddedFieldsMeta = [];
|
|
75
|
-
configFields.forEach(
|
|
78
|
+
configFields.forEach(field => {
|
|
76
79
|
let value = field;
|
|
77
80
|
if (isEmbeddedField(value)) {
|
|
78
81
|
// conversion Page.PageList[].property => Page.PageList.property
|
|
@@ -96,8 +99,8 @@ export function getConfigEmbeddedFieldsMeta(configFields, classID) {
|
|
|
96
99
|
*/
|
|
97
100
|
export function mergeConfigEmbeddedFieldsMeta(configEmbeddedFieldsMeta, metaFields) {
|
|
98
101
|
const mergedMetaFields = [...metaFields];
|
|
99
|
-
configEmbeddedFieldsMeta.forEach(
|
|
100
|
-
const fieldMeta = metaFields.find(
|
|
102
|
+
configEmbeddedFieldsMeta.forEach(configFieldMeta => {
|
|
103
|
+
const fieldMeta = metaFields.find(metaField => metaField.fieldID === configFieldMeta.fieldID);
|
|
101
104
|
if (!fieldMeta) mergedMetaFields.push(configFieldMeta);
|
|
102
105
|
});
|
|
103
106
|
return mergedMetaFields;
|
|
@@ -155,7 +158,7 @@ export function preparePropertyValue(value) {
|
|
|
155
158
|
// FIXME #EmbeddedPropertyPatch
|
|
156
159
|
// TODO: Remove this utility when we have nested response for queryable pageList and supports scalarList component
|
|
157
160
|
export function updatePageListFieldsConfig(configFields) {
|
|
158
|
-
return configFields.forEach(
|
|
161
|
+
return configFields.forEach(item => {
|
|
159
162
|
if (item.type === 'ScalarList') {
|
|
160
163
|
if (!item.config.originalValue) {
|
|
161
164
|
item.config.originalValue = item.config.value;
|
|
@@ -169,7 +172,7 @@ export function updatePageListFieldsConfig(configFields) {
|
|
|
169
172
|
* Update the renderer type for the properties of type Page.
|
|
170
173
|
*/
|
|
171
174
|
export function updatePageFieldsConfig(configFields, parentClassID) {
|
|
172
|
-
return configFields.forEach(
|
|
175
|
+
return configFields.forEach(item => {
|
|
173
176
|
const {
|
|
174
177
|
type,
|
|
175
178
|
config: { value }
|
|
@@ -259,7 +262,7 @@ export function preparePropertyMaps(fields, classID, context) {
|
|
|
259
262
|
export function getPageListFields(fields) {
|
|
260
263
|
const parentPaths = new Set();
|
|
261
264
|
const pageListFields = [];
|
|
262
|
-
fields.forEach(
|
|
265
|
+
fields.forEach(field => {
|
|
263
266
|
const { name } = field;
|
|
264
267
|
if (isPageListProperty(name)) {
|
|
265
268
|
const parentPath = name.substring(0, name.lastIndexOf(':'));
|
|
@@ -272,7 +275,12 @@ export function getPageListFields(fields) {
|
|
|
272
275
|
return pageListFields;
|
|
273
276
|
}
|
|
274
277
|
|
|
275
|
-
export function mergePageListFieldAggregation(
|
|
278
|
+
export function mergePageListFieldAggregation(
|
|
279
|
+
pageListName,
|
|
280
|
+
select,
|
|
281
|
+
existingAggregations,
|
|
282
|
+
existingAggregationsName
|
|
283
|
+
) {
|
|
276
284
|
// Build a dummy genericAggregationId to check if any type of aggregation for that pagelist is included in existing aggregations.
|
|
277
285
|
const genericAggregationId = buildAggOrCalcId(pageListName, '');
|
|
278
286
|
if (existingAggregationsName.includes(genericAggregationId)) {
|
|
@@ -287,7 +295,7 @@ export function mergePageListFieldsAggregation(fields, select, existingAggregati
|
|
|
287
295
|
const parentPaths = new Set();
|
|
288
296
|
const existingAggregationsName = Object.keys(existingAggregations).toString();
|
|
289
297
|
const pageListFields = [];
|
|
290
|
-
fields.forEach(
|
|
298
|
+
fields.forEach(field => {
|
|
291
299
|
const { name } = field;
|
|
292
300
|
if (isPageListProperty(name)) {
|
|
293
301
|
const parentPath = name.substring(0, name.lastIndexOf(':'));
|
|
@@ -309,5 +317,5 @@ export function mergePageListFieldsAggregation(fields, select, existingAggregati
|
|
|
309
317
|
* @returns {object | undefined} value of first pageListProperty found
|
|
310
318
|
*/
|
|
311
319
|
export function hasPageListProperty(fieldDefs) {
|
|
312
|
-
return fieldDefs?.find(
|
|
320
|
+
return fieldDefs?.find(field => isPageListProperty(field.name));
|
|
313
321
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable no-undef */
|
|
3
|
-
import dayjs from "dayjs";
|
|
1
|
+
import dayjs from 'dayjs';
|
|
4
2
|
import relativeTime from 'dayjs/plugin/relativeTime.js';
|
|
5
3
|
import localizedFormat from 'dayjs/plugin/localizedFormat.js';
|
|
6
4
|
import utc from 'dayjs/plugin/utc.js';
|
|
@@ -18,11 +16,11 @@ dayjs.extend(timezone);
|
|
|
18
16
|
* @param {string} text datetime
|
|
19
17
|
* @returns {object} datetime as a dayjs object
|
|
20
18
|
*/
|
|
21
|
-
export const getDayJSObject =
|
|
19
|
+
export const getDayJSObject = text => {
|
|
22
20
|
const momObj = dayjs(text);
|
|
23
21
|
if (momObj.isValid()) return momObj;
|
|
24
22
|
const timeStamp = text;
|
|
25
|
-
const isDateTime = timeStamp.indexOf(
|
|
23
|
+
const isDateTime = timeStamp.indexOf('GMT') !== -1;
|
|
26
24
|
const year = parseInt(timeStamp.substr(0, 4), 10);
|
|
27
25
|
const month = parseInt(timeStamp.substr(4, 2), 10) - 1;
|
|
28
26
|
const day = parseInt(timeStamp.substr(6, 2), 10);
|
|
@@ -48,7 +46,7 @@ export const getDayJSObject = (text) => {
|
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
mom = dayjs(
|
|
51
|
-
mom.toLocaleString(
|
|
49
|
+
mom.toLocaleString('en-US', {
|
|
52
50
|
timeZone: CurrentTz
|
|
53
51
|
})
|
|
54
52
|
);
|
|
@@ -62,8 +60,8 @@ export const getDayJSObject = (text) => {
|
|
|
62
60
|
* @param {string} time datetime
|
|
63
61
|
* @returns {object} relative time from now
|
|
64
62
|
*/
|
|
65
|
-
export const getRelativeTime =
|
|
66
|
-
let relativetime =
|
|
63
|
+
export const getRelativeTime = time => {
|
|
64
|
+
let relativetime = '';
|
|
67
65
|
if (dayjs(time).isUTC()) {
|
|
68
66
|
relativetime = dayjs(time).fromNow();
|
|
69
67
|
} else {
|
|
@@ -79,7 +77,7 @@ export const getRelativeTime = (time) => {
|
|
|
79
77
|
* @param {string} value from which Year needs to be taken out
|
|
80
78
|
* @returns {number} year for the date passed
|
|
81
79
|
*/
|
|
82
|
-
export const getFullYear =
|
|
80
|
+
export const getFullYear = value =>
|
|
83
81
|
value ? new Date(value).getFullYear() : new Date().getFullYear();
|
|
84
82
|
|
|
85
83
|
/**
|
|
@@ -129,8 +127,8 @@ export const getMinDate = (previousYears, currentYear, yearFromValue) => {
|
|
|
129
127
|
*
|
|
130
128
|
* @returns {number} clockFormat
|
|
131
129
|
*/
|
|
132
|
-
export const parseClockFormat =
|
|
133
|
-
typeof clockFormat ===
|
|
130
|
+
export const parseClockFormat = clockFormat =>
|
|
131
|
+
typeof clockFormat === 'string' ? parseInt(clockFormat, 10) : clockFormat;
|
|
134
132
|
|
|
135
133
|
/**
|
|
136
134
|
* Return datetime value string off to seconds
|
|
@@ -142,9 +140,9 @@ export const parseClockFormat = (clockFormat) =>
|
|
|
142
140
|
*/
|
|
143
141
|
export const correctDateTimeToSeconds = (datetime, withSeconds) => {
|
|
144
142
|
if (withSeconds) {
|
|
145
|
-
return `${datetime.substring(0, datetime.indexOf(
|
|
143
|
+
return `${datetime.substring(0, datetime.indexOf('Z'))}.000Z`;
|
|
146
144
|
}
|
|
147
|
-
return `${datetime.substring(0, datetime.lastIndexOf(
|
|
145
|
+
return `${datetime.substring(0, datetime.lastIndexOf(':'))}:00.000Z`;
|
|
148
146
|
};
|
|
149
147
|
|
|
150
148
|
/**
|
|
@@ -157,12 +155,9 @@ export const correctDateTimeToSeconds = (datetime, withSeconds) => {
|
|
|
157
155
|
*/
|
|
158
156
|
export const timeCorrectedToSeconds = (datetime, withSeconds) => {
|
|
159
157
|
if (withSeconds) {
|
|
160
|
-
return datetime.substring(datetime.indexOf(
|
|
158
|
+
return datetime.substring(datetime.indexOf('T') + 1, datetime.indexOf('.'));
|
|
161
159
|
}
|
|
162
|
-
return `${datetime.substring(
|
|
163
|
-
datetime.indexOf("T") + 1,
|
|
164
|
-
datetime.lastIndexOf(":")
|
|
165
|
-
)}:00`;
|
|
160
|
+
return `${datetime.substring(datetime.indexOf('T') + 1, datetime.lastIndexOf(':'))}:00`;
|
|
166
161
|
};
|
|
167
162
|
|
|
168
163
|
/**
|
|
@@ -185,14 +180,13 @@ export const datetimeFireChangeBlurEvents = (
|
|
|
185
180
|
propName,
|
|
186
181
|
pConn
|
|
187
182
|
) => {
|
|
188
|
-
|
|
189
183
|
// TODO - clean up, we should not rely on timestamp from cosmos to check InComplete validation
|
|
190
184
|
// above triggerFieldChange should have validated this
|
|
191
185
|
if (errorState) {
|
|
192
186
|
pConn.getValidationApi().validate(errorState);
|
|
193
187
|
}
|
|
194
188
|
// BUG-640834 In errorState presist old values avoiding store update & re-render.
|
|
195
|
-
else{
|
|
189
|
+
else {
|
|
196
190
|
if (formattedValue !== actualValue) {
|
|
197
191
|
actions.updateFieldValue(propName, formattedValue);
|
|
198
192
|
}
|
|
@@ -213,27 +207,27 @@ export const getDateFormat = (locale, options) => {
|
|
|
213
207
|
.formatToParts()
|
|
214
208
|
.map(({ type, value }) => {
|
|
215
209
|
switch (type) {
|
|
216
|
-
case
|
|
217
|
-
return
|
|
218
|
-
case
|
|
219
|
-
return
|
|
220
|
-
case
|
|
221
|
-
return
|
|
222
|
-
case
|
|
223
|
-
return
|
|
224
|
-
case
|
|
225
|
-
return
|
|
226
|
-
case
|
|
227
|
-
return
|
|
228
|
-
case
|
|
229
|
-
return
|
|
230
|
-
case
|
|
210
|
+
case 'day':
|
|
211
|
+
return 'DD';
|
|
212
|
+
case 'month':
|
|
213
|
+
return 'MM';
|
|
214
|
+
case 'year':
|
|
215
|
+
return 'YYYY';
|
|
216
|
+
case 'hour':
|
|
217
|
+
return 'hh';
|
|
218
|
+
case 'minute':
|
|
219
|
+
return 'mm';
|
|
220
|
+
case 'second':
|
|
221
|
+
return 'ss';
|
|
222
|
+
case 'dayPeriod':
|
|
223
|
+
return 'A';
|
|
224
|
+
case 'literal':
|
|
231
225
|
return value;
|
|
232
226
|
default:
|
|
233
|
-
return
|
|
227
|
+
return '';
|
|
234
228
|
}
|
|
235
229
|
})
|
|
236
|
-
.join(
|
|
230
|
+
.join('');
|
|
237
231
|
};
|
|
238
232
|
|
|
239
233
|
/**
|
|
@@ -243,15 +237,13 @@ export const getDateFormat = (locale, options) => {
|
|
|
243
237
|
* @returns {boolean} True or False for the locale
|
|
244
238
|
* Example : getDateFormat("pl-PL") returns false
|
|
245
239
|
*/
|
|
246
|
-
export const is12HClockFormat =
|
|
240
|
+
export const is12HClockFormat = locale => {
|
|
247
241
|
const meridiem = new Intl.DateTimeFormat(locale, {
|
|
248
|
-
hour:
|
|
242
|
+
hour: 'numeric'
|
|
249
243
|
})
|
|
250
244
|
.formatToParts()
|
|
251
|
-
.find(({ type }) => type ===
|
|
252
|
-
return !!(meridiem === null || meridiem === undefined
|
|
253
|
-
? undefined
|
|
254
|
-
: meridiem.value);
|
|
245
|
+
.find(({ type }) => type === 'dayPeriod');
|
|
246
|
+
return !!(meridiem === null || meridiem === undefined ? undefined : meridiem.value);
|
|
255
247
|
};
|
|
256
248
|
|
|
257
249
|
/**
|
|
@@ -264,9 +256,9 @@ export const is12HClockFormat = (locale) => {
|
|
|
264
256
|
*/
|
|
265
257
|
export const getTimeOptions = (withSeconds, is12h = false) => {
|
|
266
258
|
return {
|
|
267
|
-
hour:
|
|
268
|
-
minute:
|
|
269
|
-
...(withSeconds && { second:
|
|
259
|
+
hour: 'numeric',
|
|
260
|
+
minute: 'numeric',
|
|
261
|
+
...(withSeconds && { second: 'numeric' }),
|
|
270
262
|
hour12: is12h
|
|
271
263
|
};
|
|
272
264
|
};
|
|
@@ -281,9 +273,9 @@ export const getTimeOptions = (withSeconds, is12h = false) => {
|
|
|
281
273
|
*/
|
|
282
274
|
export const getDateTimeOptions = (withSeconds, is12h = false) => {
|
|
283
275
|
return {
|
|
284
|
-
year:
|
|
285
|
-
month:
|
|
286
|
-
day:
|
|
276
|
+
year: 'numeric',
|
|
277
|
+
month: 'numeric',
|
|
278
|
+
day: 'numeric',
|
|
287
279
|
...getTimeOptions(withSeconds, is12h)
|
|
288
280
|
};
|
|
289
281
|
};
|