kineticsocial / angularjs-datetime-picker

AngularJS DateTime Picker Without JQuery and Bootstrap
MIT License
66 stars 79 forks source link

Added validation #1

Closed lancegliser closed 9 years ago

lancegliser commented 9 years ago

I had need of future based date validation to accompany this directive. I've added basic date validation, along with future. Perhaps it should be abstracted a bit, but it will let you review the idea.

One important note is that an ng-model dependency has been introduced!

lancegliser commented 9 years ago

Oh, I also fixed a tiny html template issue. var div = angular.element('

'); was previously missing the closing >.

allenhwkim commented 9 years ago

Does it mean this requires ngModel? How about ngModel as optional?

allenhwkim commented 9 years ago

How about instead of future-only, why don't we have min-date, max-date, min-time, max-time and make it not available if not within range?

Users may have requirement of 'this year only', 'this month only', or 'work hours only' kind of cases.

lancegliser commented 9 years ago

RE: "Does it mean this requires ngModel? How about ngModel as optional?" Without defining that it requires a controller in the link function, you aren't provided the 4th argument of ctrl that we need for adding validation watchers.

Regarding other validation attributes, that makes perfect sense. I expected others would have their own, after it was clear how to add them. My use case was just more simple.

allenhwkim commented 9 years ago

ok i will merge your request as it is, and make some changes on it. future-only may change to min-date="today" though.