Skip to content

Commit e0df1ad

Browse files
committed
Add function to apply new date value.
An applyDateValue() function is introduced which sets the new date value and triggers the changeDate action. This seems like a better solution to me because now _updateDatePicker is called as well and calling _didChangeDate when the input field was cleared felt strange (I passed an event param which didn't make any sense at all since in that case event.date was never set)
1 parent 19f9559 commit e0df1ad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

addon/components/datepicker-support.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ export default Ember.Mixin.create({
4848
self._didChangeDate(event);
4949
});
5050
}).
51-
on('input', function(event) {
51+
on('input', function() {
5252
if (!self.$().val()) {
53-
self._didChangeDate(event);
53+
self._applyDateValue(null);
5454
}
5555
});
5656

@@ -77,6 +77,10 @@ export default Ember.Mixin.create({
7777
}
7878

7979
this.set('mustUpdateInput', false);
80+
this._applyDateValue(value);
81+
},
82+
83+
_applyDateValue: function(value) {
8084
this.set('value', value);
8185
this.sendAction('changeDate', value);
8286
},

0 commit comments

Comments
 (0)