angularjs - Angular Strap: Date Range (Start Date Not Working) -
i building simple angular search form, uses bootstrap design framework , angular strap module (found here: http://mgcrea.github.io/angular-strap/).
everything works great except dynamic date ranges based on angular models.
what want quite simple: second date input starts 1st input selected. heres code not work:
depart date (1st input) [works fine]
<input required name="dapart_date" class="form-control" id="leave_date" placeholder="mm/dd/yyyy" ng-model="flightsearchdata.depart_date" data-date-format="mm/dd/yyyy" data-use-native="true" data-autoclose="true" data-min-date="today" bs-datepicker>
return date (2nd input) [data-start-date
doesn't work]
<input required name="return_date" class="form-control" id="return_date" placeholder="mm/dd/yyyy" ng-model="flightsearchdata.return_date" data-date-format="mm/dd/yyyy" data-use-native="true" data-autoclose="true" data-min-date="{{flightsearchdata.depart_date}}" data-start-date="{{flightsearchdata.depart_date}}" bs-datepicker>
data-min-date
works fine data-start-date
works if hard code date.
any suggestions...?
it not solution, quick workaround makes datepicker usable such case.
i added datefrom watch , update dateto accordingly:
$scope.$watch('datefrom', function() { if ($scope.datefrom) { $scope.dateto = new date($scope.datefrom.gettime()); // basic date manipulation $scope.dateto.setdate($scope.datefrom.getdate() + 1); } });
it makes dateto datepicker change view focus on selected date. it's not perfect, works me.
Comments
Post a Comment