material
material copied to clipboard
Form submits wrong date because md-datepicker is slow to update model date
Actual Behavior:
What is the issue? *When using md-datepicker inside a form with ng-submit it is possible to change the date and submitting the form before the model value has updated. The old date is submitted.What is the expected behavior?It is expected that once a value in md-datepicker is updated that the form would submit the updated value.
CodePen (or steps to reproduce the issue): *
CodePen Demo which shows your issue:https://codepen.io/horduringi/pen/EXpzwLDetails:Information on how to reproduce the bug are included in pen.
- Change date with keyboard.
- Press enter or submit by clicking before model date has changed.
- Observe that submitted date is different from datepicker and model date (finally updated).
AngularJS Versions: *
AngularJS Version:1.6.5AngularJS Material Version:1.1.4
Additional Information:
Browser Type: *ChromeBrowser Version: *59.0.3071.115 (Official Build) (64-bit) (cohort: Stable)OS: *Windows 10Stack Traces:N/A
Shortcut to create a new CodePen Demo.
Note: * indicates required information. Without this information, your issue may be auto-closed.
Do not modify the titles or questions. Simply add your responses to the ends of the questions. Add more lines if needed.
Cause:
Default value for debounceInterval is 500ms, as stated in the documentation: https://material.angularjs.org/latest/api/directive/mdDatepicker
Solution:
Set md-debounce-interval="0" on datepicker. I updated the pen to demonstrate the problem and solution.
This issue may be closed.