DatePicker: fix dates selection date jump (#10973)

see issue #10890
This commit is contained in:
Jiewei Qian 2018-05-03 12:26:25 +10:00 committed by 杨奕
parent 326c0abb2a
commit 31b65b8e51
2 changed files with 2 additions and 0 deletions

View File

@ -188,6 +188,7 @@
},
value(val) {
if (this.selectionMode === 'dates' && this.value) return;
if (isDate(val)) {
this.date = new Date(val);
} else {

View File

@ -28,6 +28,7 @@ export const toDate = function(date) {
export const isDate = function(date) {
if (date === null || date === undefined) return false;
if (isNaN(new Date(date).getTime())) return false;
if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
return true;
};