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

fix(datepicker): ensure format string is initialized #2137

Closed
wants to merge 1 commit into from

Conversation

kherrala
Copy link

@kherrala kherrala commented May 3, 2014

Delayed format string initialization using attrs.$observer causes errors with datepickerPopup, because parser is constructed too early. This error was triggered by using datepickerPopup on a initially hidden tab-pane.

TypeError: Cannot read property 'split' of undefined
at createParser (http://localhost/js/vendor.min.js:1339:33)
at parse (http://localhost/js/vendor.min.js:1373:35)
at parseDate (http://localhost/js/vendor.min.js:2066:33)
at ngModel.$render (http://localhost/js/vendor.min.js:2105:22)

Delayed initialization causes errors with datepicker on a hidden tab-pane.
@bekos
Copy link
Contributor

bekos commented May 3, 2014

@kherrala Can you please provide a minimal reproduce scenario?

@terohe
Copy link

terohe commented May 5, 2014

I also get this error after upgrading from 0.10.0 to 0.11.0 if the input element had a value in it (ngModel) when initializing the datepicker (datepicker-popup):

Error: format is undefined
this.createParser@ui-bootstrap-tpls.js:751
this.parse@ui-bootstrap-tpls.js:785
parseDate@ui-bootstrap-tpls.js:1478
.link/ngModel.$render@ui-bootstrap-tpls.js:1517

@bekos
Copy link
Contributor

bekos commented May 5, 2014

@kherrala I see what but can you at least provide a test case that is failing or a plunker exposing this issue?

@kherrala
Copy link
Author

kherrala commented May 7, 2014

Here you go: http://plnkr.co/edit/G7etyf3CbYlht2n8nH0O?p=preview

It seems to work when model contains a Date-object but not with a string value.

@bekos
Copy link
Contributor

bekos commented May 7, 2014

@kherrala Thx for the plunkr. I will look into this soon.

@bekos bekos closed this in 42cc3f2 May 8, 2014
@plentz
Copy link

plentz commented May 12, 2014

@kherrala thanks for reporting it 10 days before I found the bug! Helped a lot :)

@bekos made my day. thanks a lot. :shipit:

gabegorelick pushed a commit to gabegorelick/angular-ui-bootstrap that referenced this pull request Sep 11, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants