@pega/custom-dx-components 0.23.31 → 0.23.33
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/Boolean/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Date/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/DateTime/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Integer/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Picklist/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Picklist-Autocomplete/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Picklist-RadioButtons/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Email/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Input/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/Text-URL/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Field/TimeofDay/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Template/DETAILS/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Template/FORM/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Template/FORM-region/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Template/PAGE/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Widget/CASE/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.tsx.mustache +0 -2
- package/src/tasks/create/templates/Launchpad/Widget/PAGE-CASE/index.tsx.mustache +0 -2
- package/src/tasks/init/template/.eslintrc.json +4 -1
- package/src/tasks/init/template/package.json.mustache +1 -1
- package/tests/assets/components/create/Pega_DXIL_MyTestText/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyAutocomplete/embed-utils.js +11 -22
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyAutocomplete/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyBoolean/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCaseWidget/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyCurrency/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDate/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/date-utils.js +47 -41
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/date.js +67 -54
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDateTime/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDecimal/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyDetails/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyEmail/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyForm/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyInteger/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPage/utils.js +9 -12
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageCaseWidget/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPageWidget/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyParagraph/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPercentage/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPhone/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyPicklist/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyRadioButtons/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyText/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTextInput/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTimeOfDay/time-of-day.js +47 -41
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnDetails/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyTwoColumnForm/index.tsx +0 -2
- package/tests/assets/components/createAll/Constellation/Pega_DXIL_MyURL/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyAutocomplete/embed-utils.js +11 -22
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyAutocomplete/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyBoolean/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyCurrency/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDate/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/date-utils.js +47 -41
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/date.js +67 -54
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDateTime/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDecimal/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyDetails/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyEmail/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyForm/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyInteger/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPage/utils.js +9 -12
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageCaseWidget/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPageWidget/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyParagraph/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPercentage/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPhone/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyPicklist/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyRadioButtons/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyText/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTextInput/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTimeOfDay/time-of-day.js +47 -41
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnDetails/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyTwoColumnForm/index.tsx +0 -2
- package/tests/assets/components/createAll/Launchpad/Pega_DXIL_MyURL/index.tsx +0 -2
|
@@ -17,15 +17,15 @@ export function getAllFields(pConnect) {
|
|
|
17
17
|
|
|
18
18
|
let allFields = [];
|
|
19
19
|
|
|
20
|
-
const makeField = f => ({
|
|
20
|
+
const makeField = (f) => ({
|
|
21
21
|
...pConnect().resolveConfigProps(f.config),
|
|
22
22
|
type: f.type
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
const hasRegions = !!metadata.children[0]?.children;
|
|
26
26
|
if (hasRegions) {
|
|
27
|
-
allFields = metadata.children.map(region =>
|
|
28
|
-
region.children.map(field => {
|
|
27
|
+
allFields = metadata.children.map((region) =>
|
|
28
|
+
region.children.map((field) => {
|
|
29
29
|
// Do not resolve the config props if is status work, instead create component here as status badge and mark as status display
|
|
30
30
|
if (field.config?.value === '@P .pyStatusWork') {
|
|
31
31
|
field.type = 'TextInput';
|
|
@@ -110,9 +110,7 @@ export function prepareComponentInCaseSummary(configObject, getPConnect, display
|
|
|
110
110
|
// createdComponent.props.getPConnect().setInheritedProp("hideLabel", true);
|
|
111
111
|
caseSummaryComponentObject.value = createdComponent;
|
|
112
112
|
if (type === 'reference') {
|
|
113
|
-
caseSummaryComponentObject.name = createdComponent.props
|
|
114
|
-
.getPConnect()
|
|
115
|
-
.getInheritedProps().label;
|
|
113
|
+
caseSummaryComponentObject.name = createdComponent.props.getPConnect().getInheritedProps().label;
|
|
116
114
|
}
|
|
117
115
|
|
|
118
116
|
return caseSummaryComponentObject;
|
|
@@ -131,12 +129,12 @@ export function getFilteredFields(getPConnect) {
|
|
|
131
129
|
}
|
|
132
130
|
|
|
133
131
|
// Filter out fields that are not visible and unsupported types for primary fields (for CaseSummary)
|
|
134
|
-
primaryFieldsRaw = primaryFieldsRaw.filter(item => {
|
|
132
|
+
primaryFieldsRaw = primaryFieldsRaw.filter((item) => {
|
|
135
133
|
const resolvedItem = getPConnect().resolveConfigProps(item.config);
|
|
136
134
|
return resolvedItem.visibility !== false && item.type !== 'TextContent';
|
|
137
135
|
});
|
|
138
136
|
|
|
139
|
-
secondaryFieldsRaw = secondaryFieldsRaw.filter(item => {
|
|
137
|
+
secondaryFieldsRaw = secondaryFieldsRaw.filter((item) => {
|
|
140
138
|
const resolvedItem = getPConnect().resolveConfigProps(item.config);
|
|
141
139
|
return resolvedItem.visibility !== false && item.type !== 'TextContent';
|
|
142
140
|
});
|
|
@@ -163,9 +161,7 @@ export function getLayoutDataFromRegion(regionData) {
|
|
|
163
161
|
const itemPConnect = item?.getPConnect();
|
|
164
162
|
|
|
165
163
|
return {
|
|
166
|
-
id: itemPConnect?.getComponentName()
|
|
167
|
-
? `${itemPConnect.getComponentName()}--${index}`
|
|
168
|
-
: `item--${index}`,
|
|
164
|
+
id: itemPConnect?.getComponentName() ? `${itemPConnect.getComponentName()}--${index}` : `item--${index}`,
|
|
169
165
|
content: itemPConnect?.getComponent(),
|
|
170
166
|
layoutConfig: {
|
|
171
167
|
...defaultLayoutConfig,
|
|
@@ -216,8 +212,9 @@ export function getInstructions(pConnect, instructions = 'casestep') {
|
|
|
216
212
|
|
|
217
213
|
// If the annotation wasn't processed correctly, don't return any instruction text
|
|
218
214
|
if (instructions?.startsWith('@PARAGRAPH')) {
|
|
215
|
+
/* eslint-disable no-console */
|
|
219
216
|
console.error('@PARAGRAPH annotation was not processed. Hiding custom instructions.');
|
|
220
|
-
|
|
217
|
+
/* eslint-enable no-console */
|
|
221
218
|
return undefined;
|
|
222
219
|
}
|
|
223
220
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
import React from 'react';
|
|
3
1
|
import { useState, useEffect, useRef } from 'react';
|
|
4
2
|
import { TextArea as CosmosTextArea, FieldValueList, ParagraphDisplay, Text, EmailDisplay, PhoneDisplay, URLDisplay } from '@pega/cosmos-react-core';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
|
-
import React from 'react';
|
|
4
2
|
// @ts-nocheck
|
|
5
3
|
import { useState, useEffect, useRef } from 'react';
|
|
6
4
|
import { Select, Option, FieldValueList, Text } from '@pega/cosmos-react-core';
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/* eslint-disable no-nested-ternary */
|
|
2
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
3
|
-
import React from 'react';
|
|
4
2
|
import { useMemo } from 'react';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
6
4
|
import { RadioButton, RadioButtonGroup } from '@pega/cosmos-react-core';
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
import React from 'react';
|
|
3
1
|
import { useEffect, useState, useRef } from 'react';
|
|
4
2
|
import { Input, FieldValueList, Text, EmailDisplay, PhoneDisplay, URLDisplay } from '@pega/cosmos-react-core';
|
|
5
3
|
import PropTypes from 'prop-types';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import dayjs from
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
2
|
import relativeTime from 'dayjs/plugin/relativeTime.js';
|
|
3
3
|
import localizedFormat from 'dayjs/plugin/localizedFormat.js';
|
|
4
4
|
import utc from 'dayjs/plugin/utc.js';
|
|
@@ -16,11 +16,11 @@ dayjs.extend(timezone);
|
|
|
16
16
|
* @param {string} text datetime
|
|
17
17
|
* @returns {object} datetime as a dayjs object
|
|
18
18
|
*/
|
|
19
|
-
export const getDayJSObject = text => {
|
|
19
|
+
export const getDayJSObject = (text) => {
|
|
20
20
|
const momObj = dayjs(text);
|
|
21
21
|
if (momObj.isValid()) return momObj;
|
|
22
22
|
const timeStamp = text;
|
|
23
|
-
const isDateTime = timeStamp.indexOf(
|
|
23
|
+
const isDateTime = timeStamp.indexOf("GMT") !== -1;
|
|
24
24
|
const year = parseInt(timeStamp.substr(0, 4), 10);
|
|
25
25
|
const month = parseInt(timeStamp.substr(4, 2), 10) - 1;
|
|
26
26
|
const day = parseInt(timeStamp.substr(6, 2), 10);
|
|
@@ -46,7 +46,7 @@ export const getDayJSObject = text => {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
mom = dayjs(
|
|
49
|
-
mom.toLocaleString(
|
|
49
|
+
mom.toLocaleString("en-US", {
|
|
50
50
|
timeZone: CurrentTz
|
|
51
51
|
})
|
|
52
52
|
);
|
|
@@ -60,8 +60,8 @@ export const getDayJSObject = text => {
|
|
|
60
60
|
* @param {string} time datetime
|
|
61
61
|
* @returns {object} relative time from now
|
|
62
62
|
*/
|
|
63
|
-
export const getRelativeTime = time => {
|
|
64
|
-
let relativetime =
|
|
63
|
+
export const getRelativeTime = (time) => {
|
|
64
|
+
let relativetime = "";
|
|
65
65
|
if (dayjs(time).isUTC()) {
|
|
66
66
|
relativetime = dayjs(time).fromNow();
|
|
67
67
|
} else {
|
|
@@ -77,7 +77,7 @@ export const getRelativeTime = time => {
|
|
|
77
77
|
* @param {string} value from which Year needs to be taken out
|
|
78
78
|
* @returns {number} year for the date passed
|
|
79
79
|
*/
|
|
80
|
-
export const getFullYear = value =>
|
|
80
|
+
export const getFullYear = (value) =>
|
|
81
81
|
value ? new Date(value).getFullYear() : new Date().getFullYear();
|
|
82
82
|
|
|
83
83
|
/**
|
|
@@ -127,8 +127,8 @@ export const getMinDate = (previousYears, currentYear, yearFromValue) => {
|
|
|
127
127
|
*
|
|
128
128
|
* @returns {number} clockFormat
|
|
129
129
|
*/
|
|
130
|
-
export const parseClockFormat = clockFormat =>
|
|
131
|
-
typeof clockFormat ===
|
|
130
|
+
export const parseClockFormat = (clockFormat) =>
|
|
131
|
+
typeof clockFormat === "string" ? parseInt(clockFormat, 10) : clockFormat;
|
|
132
132
|
|
|
133
133
|
/**
|
|
134
134
|
* Return datetime value string off to seconds
|
|
@@ -140,9 +140,9 @@ export const parseClockFormat = clockFormat =>
|
|
|
140
140
|
*/
|
|
141
141
|
export const correctDateTimeToSeconds = (datetime, withSeconds) => {
|
|
142
142
|
if (withSeconds) {
|
|
143
|
-
return `${datetime.substring(0, datetime.indexOf(
|
|
143
|
+
return `${datetime.substring(0, datetime.indexOf("Z"))}.000Z`;
|
|
144
144
|
}
|
|
145
|
-
return `${datetime.substring(0, datetime.lastIndexOf(
|
|
145
|
+
return `${datetime.substring(0, datetime.lastIndexOf(":"))}:00.000Z`;
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
/**
|
|
@@ -155,9 +155,12 @@ export const correctDateTimeToSeconds = (datetime, withSeconds) => {
|
|
|
155
155
|
*/
|
|
156
156
|
export const timeCorrectedToSeconds = (datetime, withSeconds) => {
|
|
157
157
|
if (withSeconds) {
|
|
158
|
-
return datetime.substring(datetime.indexOf(
|
|
158
|
+
return datetime.substring(datetime.indexOf("T") + 1, datetime.indexOf("."));
|
|
159
159
|
}
|
|
160
|
-
return `${datetime.substring(
|
|
160
|
+
return `${datetime.substring(
|
|
161
|
+
datetime.indexOf("T") + 1,
|
|
162
|
+
datetime.lastIndexOf(":")
|
|
163
|
+
)}:00`;
|
|
161
164
|
};
|
|
162
165
|
|
|
163
166
|
/**
|
|
@@ -180,13 +183,14 @@ export const datetimeFireChangeBlurEvents = (
|
|
|
180
183
|
propName,
|
|
181
184
|
pConn
|
|
182
185
|
) => {
|
|
186
|
+
|
|
183
187
|
// TODO - clean up, we should not rely on timestamp from cosmos to check InComplete validation
|
|
184
188
|
// above triggerFieldChange should have validated this
|
|
185
189
|
if (errorState) {
|
|
186
190
|
pConn.getValidationApi().validate(errorState);
|
|
187
191
|
}
|
|
188
192
|
// BUG-640834 In errorState presist old values avoiding store update & re-render.
|
|
189
|
-
else
|
|
193
|
+
else{
|
|
190
194
|
if (formattedValue !== actualValue) {
|
|
191
195
|
actions.updateFieldValue(propName, formattedValue);
|
|
192
196
|
}
|
|
@@ -207,27 +211,27 @@ export const getDateFormat = (locale, options) => {
|
|
|
207
211
|
.formatToParts()
|
|
208
212
|
.map(({ type, value }) => {
|
|
209
213
|
switch (type) {
|
|
210
|
-
case
|
|
211
|
-
return
|
|
212
|
-
case
|
|
213
|
-
return
|
|
214
|
-
case
|
|
215
|
-
return
|
|
216
|
-
case
|
|
217
|
-
return
|
|
218
|
-
case
|
|
219
|
-
return
|
|
220
|
-
case
|
|
221
|
-
return
|
|
222
|
-
case
|
|
223
|
-
return
|
|
224
|
-
case
|
|
214
|
+
case "day":
|
|
215
|
+
return "DD";
|
|
216
|
+
case "month":
|
|
217
|
+
return "MM";
|
|
218
|
+
case "year":
|
|
219
|
+
return "YYYY";
|
|
220
|
+
case "hour":
|
|
221
|
+
return "hh";
|
|
222
|
+
case "minute":
|
|
223
|
+
return "mm";
|
|
224
|
+
case "second":
|
|
225
|
+
return "ss";
|
|
226
|
+
case "dayPeriod":
|
|
227
|
+
return "A";
|
|
228
|
+
case "literal":
|
|
225
229
|
return value;
|
|
226
230
|
default:
|
|
227
|
-
return
|
|
231
|
+
return "";
|
|
228
232
|
}
|
|
229
233
|
})
|
|
230
|
-
.join(
|
|
234
|
+
.join("");
|
|
231
235
|
};
|
|
232
236
|
|
|
233
237
|
/**
|
|
@@ -237,13 +241,15 @@ export const getDateFormat = (locale, options) => {
|
|
|
237
241
|
* @returns {boolean} True or False for the locale
|
|
238
242
|
* Example : getDateFormat("pl-PL") returns false
|
|
239
243
|
*/
|
|
240
|
-
export const is12HClockFormat = locale => {
|
|
244
|
+
export const is12HClockFormat = (locale) => {
|
|
241
245
|
const meridiem = new Intl.DateTimeFormat(locale, {
|
|
242
|
-
hour:
|
|
246
|
+
hour: "numeric"
|
|
243
247
|
})
|
|
244
248
|
.formatToParts()
|
|
245
|
-
.find(({ type }) => type ===
|
|
246
|
-
return !!(meridiem === null || meridiem === undefined
|
|
249
|
+
.find(({ type }) => type === "dayPeriod");
|
|
250
|
+
return !!(meridiem === null || meridiem === undefined
|
|
251
|
+
? undefined
|
|
252
|
+
: meridiem.value);
|
|
247
253
|
};
|
|
248
254
|
|
|
249
255
|
/**
|
|
@@ -256,9 +262,9 @@ export const is12HClockFormat = locale => {
|
|
|
256
262
|
*/
|
|
257
263
|
export const getTimeOptions = (withSeconds, is12h = false) => {
|
|
258
264
|
return {
|
|
259
|
-
hour:
|
|
260
|
-
minute:
|
|
261
|
-
...(withSeconds && { second:
|
|
265
|
+
hour: "numeric",
|
|
266
|
+
minute: "numeric",
|
|
267
|
+
...(withSeconds && { second: "numeric" }),
|
|
262
268
|
hour12: is12h
|
|
263
269
|
};
|
|
264
270
|
};
|
|
@@ -273,9 +279,9 @@ export const getTimeOptions = (withSeconds, is12h = false) => {
|
|
|
273
279
|
*/
|
|
274
280
|
export const getDateTimeOptions = (withSeconds, is12h = false) => {
|
|
275
281
|
return {
|
|
276
|
-
year:
|
|
277
|
-
month:
|
|
278
|
-
day:
|
|
282
|
+
year: "numeric",
|
|
283
|
+
month: "numeric",
|
|
284
|
+
day: "numeric",
|
|
279
285
|
...getTimeOptions(withSeconds, is12h)
|
|
280
286
|
};
|
|
281
287
|
};
|