1

When user inputs date range using angular-ui Datepicker, I wanna make mindate of EndDate set 'StartDate`.

in my view,

<div class="input-daterange input-group" id="datepicker">
  <input type="text" class="input form-control" name="ev_StartDate"
   ng-model="evStartDate" ng-required="true" is-open="startPop.opened"
   ng-focus="openStart()" uib-datepicker-popup="{{format}}" 
   alt-input-formats="altInputFormats" datepicker-options="startDateOptions" 
   readonly="true">
  <span class="input-group-addon">~</span>
  <input type="text" class="input form-control" name="ev_EndDate" 
   ng-model="evEndDate" ng-required="true" is-open="endPop.opened" 
   ng-focus="openEnd()" uib-datepicker-popup="{{format}}" 
   alt-input-formats="altInputFormats" datepicker-options="endDateOptions" 
   readonly="true">
</div>

which directive is right to use?

$scope.startDateOptions = {
  showWeeks: false,
  startingDay: 1
};

$scope.setOption = function() {
   ????????
  };

$scope.endDateOptions = {
  showWeeks: false,
  startingDay: 1,
  minDate: ?????
};

1 Answer 1

2

You can use min-date attribute, where you can directly pass in the scope variable of startdate which is evStartDate. Add below attribute to End date input element.

min-date="evStartDate"
Sign up to request clarification or add additional context in comments.

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.