【发布时间】:2018-04-06 08:10:26
【问题描述】:
我的日期选择器只显示月份。 它应该只显示当前月份,其余月份应该被禁用。
我尝试过使用min-date 和max-date,但它不起作用。
HTML:
<input type="text" class="form-control"
readonly="readonly" ng-model="xxxx"
min-mode="'month'" min-date="startmnth" max-date="endmnth"
datepicker-popup="yyyy-MM" is_open="status.date_opened"
ng-required="true" placeholder="YYYY-MM"
datepicker-options="datepickerOptions"
datepicker-mode="'month'" ng-click="openfromDate($event)"
show-button-bar="false">
JS:
$scope.startmnth = new Date().getMonth()
$scope.endmnth = new Date().getMonth()
$scope.datepickerOptions = {
startingDay: 1,
};
$scope.openfromDate = function ($event) {
$event.preventDefault();
$event.stopPropagation();
$scope.status.date_opened = true;
};
【问题讨论】:
-
为什么你不使用
标签。它肯定会帮助你
标签: javascript jquery angularjs date datepicker