fix(ui): remove newlines in fromFlux parser only for time strings

pull/18560/head
Timmy Luong 2020-06-16 20:12:40 -07:00
parent 2135042485
commit cbf6a96ce4
1 changed files with 4 additions and 7 deletions

View File

@ -29,16 +29,13 @@ const TO_COLUMN_TYPE: TypeTranslationMap = {
type ParsedReturnTypes = string | undefined | null | number | boolean
function parseValue(
value: string,
value: string | undefined,
columnType: InternalTypes
): ParsedReturnTypes {
if (!value) {
return value
if (value === undefined) {
return undefined
}
// remove newlines from the last column
value = value.replace(/(\r\n|\n|\r)/gm, '')
if (value === 'null') {
return null
}
@ -60,7 +57,7 @@ function parseValue(
}
if (columnType === InternalTypes.time) {
return Date.parse(value)
return Date.parse(value.replace(/(\r\n|\n|\r)/gm, '')) // remove newlines from time strings
}
if (columnType === InternalTypes.number && value === '') {