「from」と「to」の日付を設定する必要があります。私は過去からではなく、将来的にトモロウや日付からセットされた "from"から欲しい。開始日を選択した後、ピッカーに "有効"を有効にして終了日を設定しますが、最小日の範囲で設定します。そしてdomの日の範囲を表示します。 私は公式ページからgithubソリューションを試していますが、すべてが角度データ範囲ではなくブートストラップdaterangeからです。 thnx ここでは、日付を使用している場合は、HTMLコード角度daterangepicker - 「FROM」の日付のほうが
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p class="input-group">
<input type="text"
class="form-control"
datetime-picker="yyyy-MM-dd"
ng-model="ctrl.picker4.date"
is-open="ctrl.picker4.open"
enable-time="false"
datepicker-options="ctrl.picker4.datepickerOptions"
myformat
/>
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="ctrl.openCalendar($event, 'picker4')"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
</div>
</div>
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12 form-group">
<label class="col-lg-2 col-xs-2 control-label" style="color: #fff">To</label>
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<p class="input-group">
<input type="text"
class="form-control"
datetime-picker="yyyy-MM-dd"
ng-model="ctrl.picker5.date"
is-open="ctrl.picker5.open"
enable-time="false"
datepicker-options="ctrl.picker5.datepickerOptions"
myformat
/>
<span class="input-group-btn">
<button type="button" class="btn btn-default" ng-click="ctrl.openCalendar($event, 'picker5')"><i class="glyphicon glyphicon-calendar"></i></button>
</span>
</p>
</div>
</div>
、ここではdaterangepicker(http://www.daterangepicker.com/)を使用した方が良い範囲コントローラ
//date picker
var that = this;
// date picker
// min date picker
this.picker4 = {
date: new Date(),
datepickerOptions: {
showWeeks: true,
startingDay: 1,
maxDate: null
}
};
// max date picker
this.picker5 = {
date: new Date(),
datepickerOptions: {
showWeeks: true,
startingDay: 1,
minDate: null
}
};
/*
// set date for max picker, 10 days in future
this.picker5.date.setDate(this.picker5.date.getDate() + 10);
*/
// when closed picker
this.picker13 = {
date: new Date(),
closed: function (args) {
that.closedArgs = args;
}
};
this.openCalendar = function (e, picker) {
that[picker].open = true;
};
// watch min and max dates to calculate difference
var unwatchMinMaxValues = $scope.$watch(function() {
return [that.picker4, that.picker5, that.picker10, that.picker11];
}, function() {
// min max dates
that.picker4.datepickerOptions.maxDate = that.picker5.date;
that.picker5.datepickerOptions.minDate = that.picker4.date;
if (that.picker4.date && that.picker5.date) {
var diff = that.picker4.date - that.picker5.date;
that.dayRange = Math.round(Math.abs(diff/(1000 * 60 * 60 * 24)))
} else {
that.dayRange = 'n/a';
}
}, true);
// destroy watcher
$scope.$on('$destroy', function() {
unwatchMinMaxValues();
});
<入力min = "'2014-02-23'" ...これを試すことができますか? – ArtemKh
こんにちは、私はtomorowの日付を設定する必要があります。いつも1日+ – Arter