[datepicker] format
I just upgraded from ui-bootstrap 0.13.0 to 0.13.3 and I got a problem with my datepicker directive.
As you can see in this plunkr : here
I have a directive that convert a date to a localdate and format ngModel in iso format (yyyy-MM-dd).
Everything works fine when I don't set
datepickerPopupConfig.datepickerPopup = 'dd/MM/yyyy';
But when i uncomment this line (at the bottom of example.js file), if I choose a date nothing is set in ngModel.$modelValue and ngModel is markup as 'ng-invalid-date'.
If I set the input to type="date", this is working but I don't want to do that.
Is this an issue of ui-bootstrap? Am I doing something wrong?
Thanks a lot
The dates provided now must be a date instance - this is due to cross-browser date string parsing issues causing various UI bugs. The commit that likely has caused this is https://github.com/angular-ui/bootstrap/commit/ab4580fd .
Thanks for highlighting the commit that caused this incompatibly. Any idea to resolve it except forking repo?
This was an intentional breaking change - unfortunately, your best recourse is to convert your string to a date object before attaching it to the model.
I am closing this as per comments - I should note that I am currently working on a major refactor of the dateParser, datepicker, and timepicker to support custom parsers in order to allow moment.js support, so there are more breaking changes in the horizon.
@wesleycho May I see your work about plugging custom parsers? I would like to help. Do you have a public branch that I can fork?
@wesleycho Nothing new?
Any update on allowing the date and time pickers to work with momentjs? Working with moments is much easier to do than the native Date object!
@areid31891, it's still on the todo list.
+1 for working with momentjs. The latest update, which now uses native methods getFullYear and so on, means the model passed in can no longer be a Moment.