Skip to content

Commit

Permalink
Fixed #70 - Poor handling of user input on Calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Oct 22, 2019
1 parent c069311 commit e0aa794
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ export default {
}
}
},
oldViewDate: null,
created() {
this.updateCurrentMetaData();
this.updateInputFieldValue(this.value);
Expand Down Expand Up @@ -349,7 +350,7 @@ export default {
watch: {
value(newValue) {
this.updateCurrentMetaData();
this.updateInputFieldValue(newValue);
this.updateInputFieldValue(newValue || this.inputFieldValue);
}
},
methods: {
Expand Down Expand Up @@ -1541,6 +1542,7 @@ export default {
catch(err) {
//invalid date
$vm.updateModel(null);
$vm.inputFieldValue = val;
}
},
focus: event => {
Expand Down Expand Up @@ -1579,12 +1581,17 @@ export default {
};
},
viewDate() {
let $vm = this;
let propValue = this.value;
if (propValue && Array.isArray(propValue)) {
propValue = propValue[0];
}
return propValue || new Date();
let vDate = propValue || $vm.oldViewDate || new Date();
$vm.oldViewDate = vDate;
return vDate;
},
containerClass() {
return [
Expand Down

0 comments on commit e0aa794

Please sign in to comment.