Fixed #70 - Poor handling of user input on Calendar

pull/104/head
mertsincan 2019-10-22 13:54:17 +03:00
parent c069311169
commit e0aa79469d
1 changed files with 9 additions and 2 deletions

View File

@ -312,6 +312,7 @@ export default {
} }
} }
}, },
oldViewDate: null,
created() { created() {
this.updateCurrentMetaData(); this.updateCurrentMetaData();
this.updateInputFieldValue(this.value); this.updateInputFieldValue(this.value);
@ -349,7 +350,7 @@ export default {
watch: { watch: {
value(newValue) { value(newValue) {
this.updateCurrentMetaData(); this.updateCurrentMetaData();
this.updateInputFieldValue(newValue); this.updateInputFieldValue(newValue || this.inputFieldValue);
} }
}, },
methods: { methods: {
@ -1541,6 +1542,7 @@ export default {
catch(err) { catch(err) {
//invalid date //invalid date
$vm.updateModel(null); $vm.updateModel(null);
$vm.inputFieldValue = val;
} }
}, },
focus: event => { focus: event => {
@ -1579,12 +1581,17 @@ export default {
}; };
}, },
viewDate() { viewDate() {
let $vm = this;
let propValue = this.value; let propValue = this.value;
if (propValue && Array.isArray(propValue)) { if (propValue && Array.isArray(propValue)) {
propValue = propValue[0]; propValue = propValue[0];
} }
return propValue || new Date(); let vDate = propValue || $vm.oldViewDate || new Date();
$vm.oldViewDate = vDate;
return vDate;
}, },
containerClass() { containerClass() {
return [ return [