betsol / angular-input-date

AngularJS directive to enable support for date input type
38 stars 19 forks source link

Error: [ngModel:datefmt] Expected `2017-02-03` to be a date #10

Open Kamaw opened 7 years ago

Kamaw commented 7 years ago

hey,

when I use your code I got this error:

Error: [ngModel:datefmt] Expected2017-02-03to be a date http://errors.angularjs.org/1.5.3/ngModel/datefmt?p0=2017-02-03 at ionic.bundle.js:13438 at Array.<anonymous> (ionic.bundle.js:36469) at ngModelWatch (ionic.bundle.js:40103) at Scope.$digest (ionic.bundle.js:30230) at Scope.$apply (ionic.bundle.js:30503) at done (ionic.bundle.js:24824) at completeRequest (ionic.bundle.js:25022) at XMLHttpRequest.requestLoaded (ionic.bundle.js:24963)

html: <input type="date" placeholder="Birthday" class="textbox-n" ng-model="data.birthday">

the Birthday type is Date not string and I got this error, I don't know why !!

cya

slavafomin commented 7 years ago

Hello! Thank you for your interest in this module!

May I ask, why do you need this module? Current version on Angular supports input[date] out of the box.

Kamaw commented 7 years ago

I want use this module to change the format of my date. coz when I write in my html ng-model="data.birthday" I got the date type Long for example, 148457958, that's why ;)

slavafomin commented 7 years ago

Could you please create a Plunk to demonstrate the issue?

yhoshua6 commented 7 years ago

this is the solution data.birthday = new Date(data.birthday);

elyohan14 commented 6 years ago

But decrements 1 day to the date! How can i avoid it?

fabritha commented 4 years ago

new Date(data.birthday + '23:59:59');