I am using bootstrap datepicker and my code is like following, Demo of the code on jsfiddle
I'm using version 2(supports both bootstrap v2 and v3) and for me this works:
$("#datepicker").datepicker( {
format: "mm/yyyy",
startView: "year",
minView: "year"
});
Notice that in the version of 1.2.0 the viewMode
has changed to startView
.
eg:
$('#sandbox-container input').datepicker({
startView: 1,
minViewMode: 1
});
http://eternicode.github.io/bootstrap-datepicker/?markup=component&format=yyyy&weekStart=&startDate=&endDate=&startView=2&minViewMode=2&todayBtn=false&language=zh-CN&orientation=auto&autoclose=on&forceParse=on#sandbox
Para visualiar los meses del año actual,visualiza solo los meses, y con el formato solo toma los meses de ese año. tambien se puede confirurar para que se visualice una cierta cantidad de meses
<script>
('#txtDateMMyyyy').datetimepicker({
format: "mm/yyyy",
startView: "year",
minView: "year"
}).datetimepicker("setDate", new Date());
</script>
I am using bootstrap calender for future date not allow with allow change in months & year only..
var j = jQuery.noConflict();
j(function () {
j(".datepicker").datepicker({ dateFormat: "dd-M-yy" }).val()
});
j(function () {
j(".Futuredatenotallowed").datepicker({
changeMonth: true,
maxDate: 0,
changeYear: true,
dateFormat: 'dd-M-yy',
language: "tr"
}).on('changeDate', function (ev) {
$(this).blur();
$(this).datepicker('hide');
}).val()
});
Why not call the $('.input-group.date').datepicker("remove");
when the select statement is changed then set your datepicker view then call the $('.input-group.date').datepicker("update");
For the latest bootstrap-datepicker
(1.4.0 at the time of writing), you need to use this:
$('#myDatepicker').datepicker({
format: "mm/yyyy",
startView: "year",
minViewMode: "months"
})
Source: Bootstrap Datepicker Options