Skip to content

Commit 6f0da54

Browse files
author
Mike Nichols
committed
remove nested if statement from DateInput.vue
simplify nested if statement in inputBlurred()
1 parent 630c08d commit 6f0da54

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/components/DateInput.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,16 @@ export default {
128128
* called once the input is blurred
129129
*/
130130
inputBlurred () {
131-
if (this.typedDate && this.typeable) {
132-
if (isNaN(Date.parse(this.input.value))) {
133-
this.clearDate()
134-
}
135-
this.input.value = null
136-
this.typedDate = null
131+
if (!this.typeable) {
132+
this.$emit('closeCalendar')
133+
return
134+
}
135+
136+
if (isNaN(Date.parse(this.input.value))) {
137+
this.clearDate()
137138
}
139+
this.input.value = null
140+
this.typedDate = null
138141
this.$emit('closeCalendar')
139142
},
140143
/**

0 commit comments

Comments
 (0)