AmirkabirDataMiners / ADM-dateTimePicker

Pure AngularJs dateTimePicker
http://amirkabirdataminers.github.io/ADM-dateTimePicker
MIT License
244 stars 92 forks source link

Error when typing the input by had with custom input #15

Closed adrianolobo closed 8 years ago

adrianolobo commented 8 years ago

When I use the datetimepicker with an custom input element like that:

` <adm-dtp ng-model='vm.entity.date_start' ng-change="vm.validateDate('start',vm.entity.date_start)" options="{multiple:false}" mindate="'{{vm.today}}'"

`

And i change the date in the input by hand i get this error in the console: TypeError: Cannot read property 'replace' of undefined

MeTe-30 commented 8 years ago

Hi, you did some mistakes.

See what you want in this Plunker

adrianolobo commented 8 years ago

Ok, thank you.

The on-change worked very well. I'm using the date in this format: "YYYY/MM/DD" not in unix, that's why I used the quotation. <adm-dtp ng-model="date" options="{default:'2015/12/15'}" mindate="1449866902553" maxdate="'2015/12/18'"></adm-dtp>

I could not replicate the bug in your plunker, I think it was fixed in version 1.1.4, I got version 1.1.0 from bower.

adrianolobo commented 8 years ago

Yeah, I keep getting that error even in the new version when i write something that is not a proper date.

TypeError: Cannot read property 'replace' of undefined

MeTe-30 commented 8 years ago

I'm using the date in this format: "YYYY/MM/DD" not in unix, that's why I used the quotation.

Yes, you're right, and your last code that i think is from demo page is correct, but in your first code mindate="'{{vm.today}}'" must be changed to mindate="{{vm.today}}".

Could you please put your code that gives this error in Plunker to help me see if it's a bug or maybe you pass the number instead of string by mistake. (e.g. <adm-dtp ng-model="date" options="{default:'1449866902553'}"></adm-dtp>, the unix is number, but passed as string)