-
Notifications
You must be signed in to change notification settings - Fork 941
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ import { CsvMapperRepresentationType, Operator } from '../modules/internal/csvMa | |
import type { AttributeColumn } from '../generated/graphql'; | ||
import { isValidTargetType } from '../modules/internal/csvMapper/csvMapper-utils'; | ||
|
||
export type InputType = string | string[] | number | Record<string, any>; | ||
export type InputType = string | string[] | boolean | number | Record<string, any>; | ||
|
||
// -- HANDLE VALUE -- | ||
|
||
|
@@ -23,10 +23,12 @@ const formatValue = (value: string, type: AttrType, column: AttributeColumn) => | |
const timezone = column.configuration?.timezone; | ||
if (type === 'string') { | ||
return value.trim(); | ||
} if (type === 'numeric') { | ||
} | ||
if (type === 'numeric') { | ||
const formattedValue = Number(value); | ||
return Number.isNaN(formattedValue) ? null : formattedValue; | ||
} if (type === 'date') { | ||
} | ||
if (type === 'date') { | ||
try { | ||
moment.suppressDeprecationWarnings = true; | ||
if (isNotEmptyField(pattern_date)) { | ||
|
@@ -40,6 +42,11 @@ const formatValue = (value: string, type: AttrType, column: AttributeColumn) => | |
return null; | ||
} | ||
} | ||
if (type === 'boolean') { | ||
const stringBoolean = value.toLowerCase().trim(); | ||
// TODO Matching value must be configurable in parser option | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
jpkha
Member
|
||
return stringBoolean === 'true' || stringBoolean === 'yes' || stringBoolean === '1'; | ||
} | ||
return value; | ||
}; | ||
|
||
|
@jpkha If this is a necessary change, it might be addressed on the side while working on #4505. wdyt ?