-
Notifications
You must be signed in to change notification settings - Fork 6.7k
datepicker popup removes angularjs basicText formatter from ngModel.$formatters #3279
Conversation
@cleftheris Can you add tests please? |
@karianna there are 8 existing tests failing before my fix related to datepicker if I use AngularJS v1.3.11 plus updated Angular Mocks in "datepicker.spec.js". But my fork of the master branch uses angular.js v1.2.16 and not 1.3.x.
Should I also commit a change in the version of the angular lib used for tests "misc/test-lib/angular.js" & "misc/test-lib/angular-mocks.js"? Please advise |
@karianna also keep in mind that I run the tests with my fix in place in angular 1.2.x and all is good there too. |
@cleftheris Thanks. see the working plunkr: http://plnkr.co/edit/0EEK4JpvW7GXqbhAgVwJ?p=preview regrads |
@antoinepairet @karianna Thanks for the update. Its true that my fix is not needed. But I got an additional bug related to commit 5f9afe5 please check my answer here. It is related to the viewValue and parsers/formatters. |
@antoinepairet I would like to point out IMHO that parsing the viewValue into a date and then filtering back in order to get the correct string to put in the input element seems like an overkill to me. The root cause of the problem is as I point out in my PR description a default $formatter put by angular core that does not apply to datepicker popup directive and should be removed once upon initialization. The accepted solution puts unnecessary overhead to the digest cycle. The default text formatter is pushed in the list of formatters by the ngModelController only when it is bound to an Regards |
…-ui#2659 Closes angular-ui#3293 Closes angular-ui#3279 Closes angular-ui#2440 Closes angular-ui#2932 Closes angular-ui#3074 Closes angular-ui#2943 Closes angular-ui#2733 Fixes angular-ui#3047 Fixes angular-ui#2659 Fixes angular-ui#2681
fixes #2899 and #2069 in angular 1.3.x.
As it seems there is a default formatter in there put by the framework that converts a javascript Date object to a string using the toString() method in order to render the value to the view. I have managed to get around it by inspecting the formatters and just removing the default if found.