Handle data more detailed

This commit is contained in:
Sergio Crisostomo 2018-05-23 08:22:30 +02:00
parent 75c9806430
commit 88156b0b83

View file

@ -226,7 +226,15 @@ export const TYPE_VALUE_RESOLVER_MAP = {
formatter: (value, format) => {
return value.filter(Boolean).map(date => formatDate(date, format)).join(',');
},
parser: (text, format) => text.split(',').map(string => parseDate(string.trim(), format))
parser: (value, format) => {
const values = typeof value === 'string' ? value.split(',') : value;
return values.map(value => {
if (value instanceof Date) return value;
if (typeof value === 'string') value = value.trim();
else if (typeof value !== 'number' && !value) value = '';
return parseDate(value, format);
});
}
},
number: {
formatter(value) {