<!doctype html>
<html ng-app="ui.bootstrap.demo">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0/angular-animate.js"></script>
<script src="https://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-1.2.4.js"></script>
<script src="script.js"></script>
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div ng-controller="DatepickerDemoCtrl">
<div class="row">
<div class="col-md-6">
<p class="input-group">
<input type="text" class="form-control" uib-datepicker-popup="{{format}}" ng-model="dt" is-open="popup.opened" datepicker-options="dateOptions"
ng-required="true" close-text="Close" ng-change="dateChange()" />
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="open()"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
</div>
</div>
<uib-timepicker ng-model="dt" hour-step="1" minute-step="15" name="sTime" show-meridian="true" min="min" max="max">
</uib-timepicker>
<pre class="alert alert-info">Time is: {{dt | date:'M/d/yyyy HH:mm' }}</pre>
</div>
<hr>
</body>
</html>
angular.module('ui.bootstrap.demo', ['ngAnimate', 'ui.bootstrap']);
angular.module('ui.bootstrap.demo').controller('DatepickerDemoCtrl', function($scope) {
$scope.format = 'yyyy/MM/dd';
$scope.min = null;
$scope.max = null;
$scope.initTimePicker = function(selectedDate) {
var min = new Date(selectedDate.getTime());
min.setHours(2);
min.setMinutes(0);
$scope.min = min;
var max = new Date(selectedDate.getTime());
max.setHours(4);
max.setMinutes(0);
$scope.max = max;
}
$scope.init = function() {
$scope.dt = new Date();
$scope.initTimePicker($scope.dt);
};
$scope.init();
$scope.clear = function() {
$scope.dt = null;
};
$scope.open = function() {
$scope.popup.opened = true;
};
$scope.popup = {
opened: false
};
$scope.dateChange = function() {
$scope.initTimePicker($scope.dt);
}
});
/* Styles go here */