File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,10 @@ export default {
112
112
return this .inputClass
113
113
},
114
114
formattedDate () {
115
+ if (! this .selectedDate ) {
116
+ return null
117
+ }
118
+
115
119
return typeof this .format === ' function'
116
120
? this .format (new Date (this .selectedDate ))
117
121
: this .utils .formatDate (
@@ -205,6 +209,11 @@ export default {
205
209
* Parses a typed date and submits it, if valid
206
210
*/
207
211
handleKeyup () {
212
+ if (this .input .value === ' ' ) {
213
+ this .$emit (' typed-date' , null )
214
+ return
215
+ }
216
+
208
217
this .parsedDate = Date .parse (
209
218
this .utils .parseDate (
210
219
this .input .value ,
Original file line number Diff line number Diff line change @@ -449,7 +449,7 @@ export default {
449
449
* @param {Date} date
450
450
*/
451
451
handleTypedDate (date ) {
452
- this .selectDate (date .valueOf ())
452
+ this .selectDate (date ? date .valueOf () : null )
453
453
},
454
454
/**
455
455
* Focus the relevant element when the view changes
@@ -530,6 +530,11 @@ export default {
530
530
* @param {Number} timestamp
531
531
*/
532
532
selectDate (timestamp ) {
533
+ if (! timestamp) {
534
+ this .selectedDate = null
535
+ return
536
+ }
537
+
533
538
const date = new Date (timestamp)
534
539
this .selectedDate = date
535
540
this .setPageDate (date)
You can’t perform that action at this time.
0 commit comments