Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Object doesn't support property or method 'getFullYear' #120

Closed
juanluis04 opened this issue May 4, 2016 · 3 comments
Closed

Comments

@juanluis04
Copy link

Everything works fine until you assign to the input a model with a predefined date. When I load a model that already has a date in format 2016-05-20T12:40:40 the input doesn't show the date and also the first time you try to open the calendar it sends this error on the browser console.

TypeError: Object doesn't support property or method 'getFullYear'

the second time you try to open the calendar it opens with no problem, the problem I had is always loading a ng-model that already has a date.
1
2
3

@Gillardo
Copy link
Owner

Gillardo commented May 4, 2016

can you create a plunkr to replicate?

@theantichris
Copy link

theantichris commented May 4, 2016

It looks like the value of your model is a string. You will need to convert it to a JavaScript Date object when your page loads. Strings do not have the getFullYear() method.

$scope.reminderForm.reminderDate = new Date($scope.reminderForm.reminderDate);

Hope this helps.

@juanluis04
Copy link
Author

Thanks theantichris, that was the problem, now I'm converting my string to new Date(data); and it works fine! 👍

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

No branches or pull requests

3 participants