Commit 88156b0b835110914b0af8669ab908b11ec86d9e

Authored by Sergio Crisostomo
1 parent 75c98064

Handle data more detailed

Showing 1 changed file with 9 additions and 1 deletions   Show diff stats
src/components/date-picker/util.js
... ... @@ -226,7 +226,15 @@ export const TYPE_VALUE_RESOLVER_MAP = {
226 226 formatter: (value, format) => {
227 227 return value.filter(Boolean).map(date => formatDate(date, format)).join(',');
228 228 },
229   - parser: (text, format) => text.split(',').map(string => parseDate(string.trim(), format))
  229 + parser: (value, format) => {
  230 + const values = typeof value === 'string' ? value.split(',') : value;
  231 + return values.map(value => {
  232 + if (value instanceof Date) return value;
  233 + if (typeof value === 'string') value = value.trim();
  234 + else if (typeof value !== 'number' && !value) value = '';
  235 + return parseDate(value, format);
  236 + });
  237 + }
230 238 },
231 239 number: {
232 240 formatter(value) {
... ...