Fixed #1477 - Add keepInvalid property to Calendar

pull/1478/head
mertsincan 2021-08-26 14:00:48 +03:00
parent bd1aac9b5e
commit f83169dd60
1 changed files with 8 additions and 2 deletions

View File

@ -289,6 +289,10 @@ export default {
type: String, type: String,
default: 'body' default: 'body'
}, },
keepInvalid: {
type: Boolean,
default: false
},
inputClass: null, inputClass: null,
inputStyle: null, inputStyle: null,
class: null, class: null,
@ -1936,7 +1940,9 @@ export default {
} }
} }
catch(err) { catch(err) {
this.updateModel(null); // invalid date
let value = this.keepInvalid ? event.target.value : null;
this.updateModel(value);
} }
}, },
onFocus() { onFocus() {
@ -1998,7 +2004,7 @@ export default {
return propValue || new Date(); return propValue || new Date();
}, },
inputFieldValue() { inputFieldValue() {
return this.formatValue(this.modelValue); return this.keepInvalid ? this.modelValue : this.formatValue(this.modelValue);
}, },
containerClass() { containerClass() {
return [ return [