Commit eac95e99 authored by cinwell.li's avatar cinwell.li Committed by baiyaaaaa

DatePicker: fix setMonth, fixed #3923 (#3935)

parent f6661e2a
......@@ -312,8 +312,7 @@
const target = new Date(type === 'min' ? this.minDate : this.maxDate);
if (target) {
target.setFullYear(parsedValue.getFullYear());
target.setMonth(parsedValue.getMonth());
target.setDate(parsedValue.getDate());
target.setMonth(parsedValue.getMonth(), parsedValue.getDate());
}
}
},
......@@ -331,8 +330,7 @@
const target = new Date(type === 'min' ? this.minDate : this.maxDate);
if (target) {
target.setFullYear(parsedValue.getFullYear());
target.setMonth(parsedValue.getMonth());
target.setDate(parsedValue.getDate());
target.setMonth(parsedValue.getMonth(), parsedValue.getDate());
}
if (type === 'min') {
if (target < this.maxDate) {
......
......@@ -293,8 +293,7 @@
this.$emit('pick', new Date(value.getTime()));
}
this.date.setFullYear(value.getFullYear());
this.date.setMonth(value.getMonth());
this.date.setDate(value.getDate());
this.date.setMonth(value.getMonth(), value.getDate());
} else if (this.selectionMode === 'week') {
this.week = value.week;
this.$emit('pick', value.date);
......
......@@ -151,11 +151,9 @@
handleChange() {
if (this.minTime > this.maxTime) return;
MIN_TIME.setFullYear(this.minTime.getFullYear());
MIN_TIME.setMonth(this.minTime.getMonth());
MIN_TIME.setDate(this.minTime.getDate());
MIN_TIME.setMonth(this.minTime.getMonth(), this.minTime.getDate());
MAX_TIME.setFullYear(this.maxTime.getFullYear());
MAX_TIME.setMonth(this.maxTime.getMonth());
MAX_TIME.setDate(this.maxTime.getDate());
MAX_TIME.setMonth(this.maxTime.getMonth(), this.maxTime.getDate());
this.$refs.minSpinner.selectableRange = [[MIN_TIME, this.maxTime]];
this.$refs.maxSpinner.selectableRange = [[this.minTime, MAX_TIME]];
this.handleConfirm(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment