Commit 283b90aa382af67e6e071ba27261de01b53cd4f4
1 parent
b5ca23f5
Fix daterange manual date insertion
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
src/components/date-picker/picker.vue
| ... | ... | @@ -310,8 +310,12 @@ |
| 310 | 310 | if (!val){ |
| 311 | 311 | val = [null, null]; |
| 312 | 312 | } else { |
| 313 | - val = val.map(date => new Date(date)); // try to parse | |
| 314 | - val = val.map(date => isNaN(date.getTime()) ? null : date); // check if parse passed | |
| 313 | + if (typeof val === 'string') { | |
| 314 | + val = parser(val, format); | |
| 315 | + } else { | |
| 316 | + val = val.map(date => new Date(date)); // try to parse | |
| 317 | + val = val.map(date => isNaN(date.getTime()) ? null : date); // check if parse passed | |
| 318 | + } | |
| 315 | 319 | } |
| 316 | 320 | } else if (typeof val === 'string' && type.indexOf('time') !== 0){ |
| 317 | 321 | val = parser(val, format) || val; | ... | ... |