Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Max/min attributes in bootstrap-ui timepicker

I want to use the timepicker directive from bootstrap-ui. I need to use the min and max attributes, but I don't understand how to use them.

I tried to use it on the range from 0 to 1440.

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

I also tried to pass different date formats, but it doesn't solve my issue. For example, I need user can set timepicker from 14:00 to 17:00. How can I achieve this effect with these attributes?

You can find a plunker here.

like image 408
Vladyslav Turak Avatar asked Feb 09 '23 20:02

Vladyslav Turak


1 Answers

You can set min and max values in controller itself:

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

var d2 = new Date();
d2.setHours( 11 );
d2.setMinutes( 0 );
$scope.max = d2;

And use them,

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

here is plunker

like image 183
Priyanka Avatar answered Feb 13 '23 12:02

Priyanka