How do you add a change listener on an input date component that has been changed via the date picker?
Here's my current approach that does not work:
.app file
<aura:application >
<ui:inputDate aura:id="dateField" label="Birthday" value="2014-01-30" displayDatePicker="true" change="{!c.handleDateChange}"/>
</aura:application>
Controller
({
handleDateChange : function(component, event, helper) {
console.log('date change');
}
})
For contrast, a listener can be set on an input text field with the same approach (the below code works)
.app file
<aura:application >
<ui:inputText label="Name" change="{!c.handleTextChange}"/>
</aura:application>
Controller
({
handleTextChange : function(component, event, helper) {
console.log('text change');
}
})
Some things that I've noticed while testing:
- Hitting 'enter' when the cursor is in date input field will cause the page to refresh
- Hitting 'tab' when the cursor is in the date input field will cause the 'change' event to fire and the controller logs the 'date change' message to the console