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

datepicker-popup formating on model change broken with angular 1.3 #3207

Closed
rguldener opened this issue Jan 20, 2015 · 1 comment
Closed

Comments

@rguldener
Copy link

As the title suggests, datepicker-popup does not properly format the date after a modal change when ui-bootstrap is used with angular 1.3

Demonstration Plunkr

Problem
The problem appears to be that, with angular 1.3, the ngModel.$viewValue passes a string in ISO format instead of a date object as used to be the case in angular 1.2. UI-Bootstrap then attempts to parse the String as either a JSON Date or a timestamp but not as an ISO date format causing it to display the ISO date string instead of the properly formatted date. You can observe this by setting a breakpoint here

Fix
The date object is still available in ngModel.$modelValue though and the fix is as simple as swapping ngMode.$viewValue for ngModel.$modelValue in the line I referenced above:

var date = ngModel.$modelValue ? dateFilter(ngModel.$modelValue, dateFormat) : '';
@rguldener
Copy link
Author

Ah I see now this has come up before, ticket in #2659 and PR is also already ready at #2943

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants