Bind angular datepicker and timepicker

Viewed 10446

I want to bind angular timepicker and datepicker. I am using Angular bootstrap library

As per documentation of timepicker, it requires new Date object for min and max values. If I simply set like this

var d = new Date();
d.setHours( 2 );
d.setMinutes( 0 );
$scope.minTime = d;

var d = new Date();
d.setHours( 11 );
d.setMinutes( 0 );
$scope.maxTime = d;

<uib-timepicker ng-model="mytime" min="min" max="max" show-meridian="false" min="minTime" max="maxTime"></uib-timepicker>

This works only for today because of new Date() object.

I want it to work on any day I select. Currently, timepicker is not restricting time as required. Also, sometimes timepicker box borders turn red (It may be due to validation errors), but does not specify what exactly is the error.

Please have a look at: http://plnkr.co/edit/LOZ9T6zexRkQpqSIaJiA?p=preview

1 Answers
Related