[英]bootstrap date picker only month and years
i am using bootstrap date picker for my angular js project.我正在为我的 angular js 项目使用引导日期选择器。
below is the HTML下面是 HTML
my date picker documentation is as below date picker documentation我的日期选择器文档如下日期选择器文档
<input type="text" placeholder="From Date" id="fromDate"
ng-required="newcashbenifit.isFixedAmount == false"
ng-disabled="newcashbenifit.isFixedAmount == true"
class="form-control" name="from" autocomplete="off"
ng-model="newcashbenifit.fromDate" autoclose="false"
data-date-format="dd/MM/yyyy" bs-datepicker />
date picker is loading and working well.日期选择器正在加载并且运行良好。 but i need to modify this to show only month and years.但我需要修改它以仅显示月份和年份。 (remove dates). (删除日期)。 how i do it.我是怎么做的。
Add min-view="1"
attribute:添加min-view="1"
属性:
Minimum allowed view - 0 |最小允许视图 - 0 | 1 | 1 | 2. 1 will only allow month selection. 2. 1 只允许选择月份。
<input type="text" placeholder="From Date" id="fromDate"
min-view="1"
ng-required="newcashbenifit.isFixedAmount == false"
ng-disabled="newcashbenifit.isFixedAmount == true"
class="form-control" name="from" autocomplete="off"
ng-model="newcashbenifit.fromDate" autoclose="false"
data-date-format="dd/MM/yyyy" bs-datepicker />
Use minViewMode:使用 minViewMode:
$('#sandbox-container input').datepicker({
minViewMode: 1
});
https://bootstrap-datepicker.readthedocs.io/en/latest/options.html#minviewmode https://bootstrap-datepicker.readthedocs.io/en/latest/options.html#minviewmode
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.