Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

datepicker popup removes angularjs basicText formatter from ngModel.$formatters #3279

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/datepicker/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,16 @@ function ($compile, $parse, $document, $position, dateFilter, dateParser, datepi
}
}
ngModel.$parsers.unshift(parseDate);

// get rid of the default angularjs text formatter that messes with the view value.
for (var i = 0; i < ngModel.$formatters.length; i++) {
var now = new Date();
var fmtFn = ngModel.$formatters[i];
var isDefault = fmtFn(now) === now.toString();
if (isDefault) {
ngModel.$formatters.splice(i, 1);
break;
}
}
// Inner change
scope.dateSelection = function(dt) {
if (angular.isDefined(dt)) {
Expand Down