eight04 / angular-datetime

A directive to add the behavior of datetime input on unsupported browsers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

date.getDate is not a function

rajeshwarpatlolla opened this issue · comments

It is giving me error as shown below.

screen shot 2016-01-19 at 12 54 58 am

commented

Looks like the date object is lack of getDate method. Check if the model is a Date object. Also, an example on Plunker would be nice 😃

I am passing date object itself.

commented

Could you provide any source code?

It seems it's missing some timezone setup. I get the same error

commented

Any example? https://plnkr.co/

commented

BTW, there was no timezone option when this issue was created.

I figured it out. As usual it's date converting stuff. I got my date from a C# WebAPI, and I had to convert it to a real javascript date

$scope.birthdate = moment($scope.user.birthdate).toDate();

commented

If you like to use a string as the model value instead of Date object, try datetime-model="format"

Is there any way to make this play nice with momentjs?

commented

I don't use momentjs. Any suggestion?

Yah I was thinking about it. Seems it would be a substantial rebuild. Ended
up finding a simpler directive that worked with it. But gosh yours is so
nice I was hoping for it to work as well. Thanks for the quick response.

On Wed, Jun 22, 2016, 1:10 PM eight notifications@github.com wrote:

I don't use momentjs. Any suggestion?


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#15 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ADbj0h0HP1jd_C80n3BcHWjk6bux5vIYks5qOWyegaJpZM4HHLUH
.

commented

Thanks for your appreciate. If you have some idea about how they should work together, feel free to create a new issue.

@james-hoegerl mind sharing it? i also get the date.getDate getting data from a c# webApi

Anyways, when getting the data from a controller simply calling
new Date($scope.theDate)
will resolve the issue

commented

@james-hoegerl

Starting from v5.0.0, the core parser and input mask are pulled out as custom-input. You might be interested to make it works with momentjs.