From 48743c7eda6da7aa15d1698ee30d69e3bc4c80e5 Mon Sep 17 00:00:00 2001 From: Ran Byron Date: Thu, 24 Jan 2019 08:15:05 +0200 Subject: [PATCH] Fixed default value date formatting --- .../app/components/ParameterMappingInput.jsx | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/client/app/components/ParameterMappingInput.jsx b/client/app/components/ParameterMappingInput.jsx index 95c186321b..813bc6c441 100644 --- a/client/app/components/ParameterMappingInput.jsx +++ b/client/app/components/ParameterMappingInput.jsx @@ -3,7 +3,6 @@ import { extend, map, includes, findIndex, find, fromPairs, isNull, isUndefined } from 'lodash'; import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; -import moment from 'moment'; import Select from 'antd/lib/select'; import Table from 'antd/lib/table'; import Popover from 'antd/lib/popover'; @@ -322,16 +321,14 @@ export class ParameterMappingListInput extends React.Component { return ''; } - // array - if (value instanceof Array) { - const arr = value.map(v => this.getStringValue(v)); - const delimiter = moment.isMoment(value[0]) ? ' ~ ' : ', '; - return arr.join(delimiter); + // range + if (value instanceof Object && 'start' in value && 'end' in value) { + return `${value.start} ~ ${value.end}`; } - // moment - if (moment.isMoment(value)) { - return value.format('DD/MM/YY'); + // just to be safe, array or object + if (typeof value === 'object') { + return map(value, v => this.getStringValue(v)).join(', '); } // rest @@ -339,10 +336,7 @@ export class ParameterMappingListInput extends React.Component { } static getDefaultValue(mapping) { - const value = mapping.type === MappingType.StaticValue - ? mapping.value || mapping.param.normalizedValue - : mapping.param.normalizedValue; - + const value = mapping.value || mapping.param.value; return this.getStringValue(value); }