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

fix(timepicker): move render logic to formatter #3427

Closed

Conversation

wesleycho
Copy link
Contributor

  • Moves render logic converting model values into date or null object into a formatter, which allows the render function to more correctly render using the viewValue

Working Plunker here.

Fixes #3160 properly.

@@ -20,6 +20,10 @@ angular.module('ui.bootstrap.timepicker', [])
ngModelCtrl = ngModelCtrl_;
ngModelCtrl.$render = this.render;

ngModelCtrl.$formatters.unshift(function (modelValue) {
return (modelValue) ? new Date( modelValue ) : null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra parentheses around the first modelValue

@chrisirhc
Copy link
Contributor

LGTM (only a style comment above). This resolves the issue ? I thought it had something to do with the input fields' type .

- Moves render logic converting model values into date or null object into a formatter, which allows the render function to more correctly render using the viewValue

- remove parentheses as per CR
@wesleycho
Copy link
Contributor Author

It fixes the issue I think due to the render function incorrectly using the modelValue instead of the viewValue and formatting translating the modelValue to the viewValue.

@wesleycho
Copy link
Contributor Author

Note: this PR also would close out #2069.

@wesleycho wesleycho closed this in b4bbc01 Apr 5, 2015
@chrisirhc
Copy link
Contributor

Merged. I left #2069 open as there's still #3494 .

@wesleycho wesleycho deleted the fix/timepicker-formatting branch November 7, 2015 22:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timepicker triggers dirty flag inside ngRepeat
3 participants