@trackunit/iris-app-runtime-core 0.3.208 → 0.3.209

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/index.cjs.js CHANGED
@@ -227,12 +227,17 @@ const getStringValue = (value) => {
227
227
  */
228
228
  const getDateValue = (value) => {
229
229
  // remove timezone to ensure the date is always the same
230
- const date = typeof value === "string" ? new Date(value.substring(0, 10)) : value;
231
- const dateFormatted = date.toISOString().split("T");
232
- if (dateFormatted.length !== 2) {
230
+ try {
231
+ const date = typeof value === "string" ? new Date(value.substring(0, 10)) : value;
232
+ const dateFormatted = date.toISOString().split("T");
233
+ if (dateFormatted.length !== 2) {
234
+ return undefined;
235
+ }
236
+ return dateFormatted[0];
237
+ }
238
+ catch (_) {
233
239
  return undefined;
234
240
  }
235
- return dateFormatted[0];
236
241
  };
237
242
  /**
238
243
  * Format a custom field value to ensure a consistent representation in the ui.
@@ -242,8 +247,11 @@ const getCustomFieldValueForDisplayInUI = (value, _unit, _systemOfMeasurement, l
242
247
  return "";
243
248
  }
244
249
  const numberValue = Number(value);
250
+ if (Number.isNaN(numberValue)) {
251
+ return value;
252
+ }
245
253
  const numberAsString = numberValue > 9999
246
- ? Math.round(numberValue)
254
+ ? Math.round(numberValue).toString()
247
255
  : new Intl.NumberFormat(language, { maximumSignificantDigits: 4, minimumSignificantDigits: 4 }).format(numberValue);
248
256
  return numberAsString;
249
257
  };
@@ -254,8 +262,8 @@ const isValidCustomFieldValue = (value) => {
254
262
  const isBoolean = typeof value === "boolean";
255
263
  const isString = typeof value === "string";
256
264
  const isStringArray = Array.isArray(value) && value.every(item => typeof item === "string");
257
- const isDropdownSelectionArray = Array.isArray(value) && value.every(item => isDropdownSelection(item));
258
265
  const isDropdownSelection = (dropdownValue) => typeof dropdownValue === "object" && dropdownValue !== null && "value" in dropdownValue;
266
+ const isDropdownSelectionArray = Array.isArray(value) && value.every(item => isDropdownSelection(item));
259
267
  const isNumber = typeof value === "number";
260
268
  const isNull = value === null;
261
269
  return (isBoolean ||
package/index.esm.js CHANGED
@@ -225,12 +225,17 @@ const getStringValue = (value) => {
225
225
  */
226
226
  const getDateValue = (value) => {
227
227
  // remove timezone to ensure the date is always the same
228
- const date = typeof value === "string" ? new Date(value.substring(0, 10)) : value;
229
- const dateFormatted = date.toISOString().split("T");
230
- if (dateFormatted.length !== 2) {
228
+ try {
229
+ const date = typeof value === "string" ? new Date(value.substring(0, 10)) : value;
230
+ const dateFormatted = date.toISOString().split("T");
231
+ if (dateFormatted.length !== 2) {
232
+ return undefined;
233
+ }
234
+ return dateFormatted[0];
235
+ }
236
+ catch (_) {
231
237
  return undefined;
232
238
  }
233
- return dateFormatted[0];
234
239
  };
235
240
  /**
236
241
  * Format a custom field value to ensure a consistent representation in the ui.
@@ -240,8 +245,11 @@ const getCustomFieldValueForDisplayInUI = (value, _unit, _systemOfMeasurement, l
240
245
  return "";
241
246
  }
242
247
  const numberValue = Number(value);
248
+ if (Number.isNaN(numberValue)) {
249
+ return value;
250
+ }
243
251
  const numberAsString = numberValue > 9999
244
- ? Math.round(numberValue)
252
+ ? Math.round(numberValue).toString()
245
253
  : new Intl.NumberFormat(language, { maximumSignificantDigits: 4, minimumSignificantDigits: 4 }).format(numberValue);
246
254
  return numberAsString;
247
255
  };
@@ -252,8 +260,8 @@ const isValidCustomFieldValue = (value) => {
252
260
  const isBoolean = typeof value === "boolean";
253
261
  const isString = typeof value === "string";
254
262
  const isStringArray = Array.isArray(value) && value.every(item => typeof item === "string");
255
- const isDropdownSelectionArray = Array.isArray(value) && value.every(item => isDropdownSelection(item));
256
263
  const isDropdownSelection = (dropdownValue) => typeof dropdownValue === "object" && dropdownValue !== null && "value" in dropdownValue;
264
+ const isDropdownSelectionArray = Array.isArray(value) && value.every(item => isDropdownSelection(item));
257
265
  const isNumber = typeof value === "number";
258
266
  const isNull = value === null;
259
267
  return (isBoolean ||
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-runtime-core",
3
- "version": "0.3.208",
3
+ "version": "0.3.209",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {