mirror of https://github.com/ElemeFE/element
DateTimePicker: fix when time is disabled click confirm select.
parent
a99d0cb6fa
commit
7f67ad6df0
|
@ -307,14 +307,13 @@
|
||||||
|
|
||||||
handleTimePick(value, visible, first) {
|
handleTimePick(value, visible, first) {
|
||||||
if (isDate(value)) {
|
if (isDate(value)) {
|
||||||
let newDate = '';
|
const newDate = this.value
|
||||||
if ((!this.disabledDate || !this.disabledDate(new Date())) && this.checkDateWithinRange(new Date())) {
|
|
||||||
newDate = this.value
|
|
||||||
? modifyTime(this.value, value.getHours(), value.getMinutes(), value.getSeconds())
|
? modifyTime(this.value, value.getHours(), value.getMinutes(), value.getSeconds())
|
||||||
: modifyWithTimeString(this.getDefaultValue(), this.defaultTime);
|
: modifyWithTimeString(this.getDefaultValue(), this.defaultTime);
|
||||||
this.date = newDate;
|
this.date = newDate;
|
||||||
|
if (!this.disabledDate || !this.disabledDate(newDate)) {
|
||||||
|
this.emit(this.date, true);
|
||||||
}
|
}
|
||||||
this.emit(newDate, true);
|
|
||||||
} else {
|
} else {
|
||||||
this.emit(value, true);
|
this.emit(value, true);
|
||||||
}
|
}
|
||||||
|
@ -379,20 +378,19 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
let value = '';
|
|
||||||
if (this.selectionMode === 'dates') {
|
if (this.selectionMode === 'dates') {
|
||||||
this.emit(this.value);
|
this.emit(this.value);
|
||||||
} else {
|
} else {
|
||||||
// value were emitted in handle{Date,Time}Pick, nothing to update here
|
// value were emitted in handle{Date,Time}Pick, nothing to update here
|
||||||
// deal with the scenario where: user opens the picker, then confirm without doing anything
|
// deal with the scenario where: user opens the picker, then confirm without doing anything
|
||||||
if ((!this.disabledDate || !this.disabledDate(new Date())) && this.checkDateWithinRange(new Date())) {
|
const value = this.value
|
||||||
value = this.value
|
|
||||||
? this.value
|
? this.value
|
||||||
: modifyWithTimeString(this.getDefaultValue(), this.defaultTime);
|
: modifyWithTimeString(this.getDefaultValue(), this.defaultTime);
|
||||||
this.date = new Date(value); // refresh date
|
this.date = new Date(value); // refresh date
|
||||||
};
|
if (!this.disabledDate || !this.disabledDate(value)) {
|
||||||
this.emit(value);
|
this.emit(value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
resetView() {
|
resetView() {
|
||||||
|
|
Loading…
Reference in New Issue