2

I am trying to set the min start date.

I have tried using

<input id="StartDate" type="text" class="form-control" name="StartDate" datetime-picker="{{'yyyy-MM-dd HH:mm'}}" ng-model="vm.StartDate" is-open="vm.datePickerOpenStatus.StartDate" datepicker-options="dateOptions"  min-date="2017-07-13 00:00""/>

But it is not working. Help me out.

2

2 Answers 2

1

See if this can help you

<!DOCTYPE html>
   <html ng-app="plunker">

<head>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<link data-require="[email protected]" data-semver="3.1.1" rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
<script data-require="[email protected]" src="https://code.angularjs.org/1.2.16/angular.js" data-semver="1.2.16"></script>
<script data-require="[email protected]" data-semver="0.10.0" src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"></script>
<script src="app.js"></script>
</head>

<body ng-controller="MainCtrl">
 Min Date {{minDate}}
<input type="text" class="form-control" datepicker-popup="yyyy-MM-dd" ng-
  model="dt" min="minDate" />
</body>

</html>
 //JS
 var app = angular.module('plunker', ['ui.bootstrap']);

 app.controller('MainCtrl', function($scope) {
   $scope.minDate = new Date();
   $scope.test = function() {
   $scope.minDate = new Date();
 }
});

This new Date will put yourDate in correct format so i will put the example of this code here Plunker, and one suggetion,

var mydate = new Date('2014-04-03');
<input id="StartDate" type="text" class="form-control" name="StartDate" 
datetime-picker="{{'yyyy-MM-dd HH:mm'}}" ng-model="vm.StartDate" is-
open="vm.datePickerOpenStatus.StartDate" datepicker-options="dateOptions"  
min-date="mydate"/> //Example

This will convert your Date to correct Format :)

Sign up to request clarification or add additional context in comments.

Comments

1

Yon modify you datepicker-options. you have already used this directive only you have to add minDate:today in this.

datepicker-options="{showWeeks:false,minDate:today}"

Thanks

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.