Merge pull request #3678 from SergioCrisostomo/datepicker
Fix multidate parser value types, prevent undefined in focusedDate
This commit is contained in:
commit
3076b0d24f
2 changed files with 10 additions and 2 deletions
|
@ -651,7 +651,7 @@
|
|||
this.internalValue = Array.isArray(dates) ? dates : [dates];
|
||||
}
|
||||
|
||||
this.focusedDate = this.internalValue[0];
|
||||
if (this.internalValue[0]) this.focusedDate = this.internalValue[0];
|
||||
this.focusedTime = {
|
||||
...this.focusedTime,
|
||||
time: this.internalValue.map(extractTime)
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue