@trackunit/iris-app-runtime-core 0.3.206 → 0.3.207

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
@@ -125,9 +125,9 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
125
125
  type: "BOOLEAN",
126
126
  };
127
127
  }
128
- else if (customFieldDefinition.type === "DATE") {
128
+ else if (customFieldDefinition.type === "DATE" || newValue instanceof Date) {
129
129
  return {
130
- dateValue: newValue ? getDateValue(newValue) : null,
130
+ dateValue: typeof newValue === "string" || newValue instanceof Date ? getDateValue(newValue) : null,
131
131
  type: "DATE",
132
132
  };
133
133
  }
@@ -227,7 +227,7 @@ 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 = new Date(value.substring(0, 10));
230
+ const date = typeof value === "string" ? new Date(value.substring(0, 10)) : value;
231
231
  const dateFormatted = date.toISOString().split("T");
232
232
  if (dateFormatted.length !== 2) {
233
233
  return undefined;
package/index.esm.js CHANGED
@@ -123,9 +123,9 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
123
123
  type: "BOOLEAN",
124
124
  };
125
125
  }
126
- else if (customFieldDefinition.type === "DATE") {
126
+ else if (customFieldDefinition.type === "DATE" || newValue instanceof Date) {
127
127
  return {
128
- dateValue: newValue ? getDateValue(newValue) : null,
128
+ dateValue: typeof newValue === "string" || newValue instanceof Date ? getDateValue(newValue) : null,
129
129
  type: "DATE",
130
130
  };
131
131
  }
@@ -225,7 +225,7 @@ 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 = new Date(value.substring(0, 10));
228
+ const date = typeof value === "string" ? new Date(value.substring(0, 10)) : value;
229
229
  const dateFormatted = date.toISOString().split("T");
230
230
  if (dateFormatted.length !== 2) {
231
231
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-runtime-core",
3
- "version": "0.3.206",
3
+ "version": "0.3.207",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -15,7 +15,7 @@ export interface DropdownSelection {
15
15
  export declare const getCustomFieldValueToSaveFromRawValue: (customFieldDefinition: {
16
16
  type: CustomFieldType;
17
17
  isInteger?: boolean | null;
18
- }, newValue: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number | null) => CustomFieldValue;
18
+ }, newValue: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number | Date | null) => CustomFieldValue;
19
19
  /**
20
20
  * Convert the received value to a string
21
21
  */
@@ -24,7 +24,7 @@ export declare const getStringValue: (value: boolean | string | string[] | Dropd
24
24
  * Format the received value to a date string
25
25
  * yyyy-mm-dd
26
26
  */
27
- export declare const getDateValue: (value: string) => string | undefined;
27
+ export declare const getDateValue: (value: string | Date) => string | undefined;
28
28
  /**
29
29
  * Format a custom field value to ensure a consistent representation in the ui.
30
30
  */