I have a datepicker which I only want the user to be able to select a month and year.
The user should only be able to select up to a year from todays date. I have this working but I cant seem to get only the months displaying.
HTML
<div class="form-groups">
<div class="col-sm-12">
<div class="input-group">
<input type="text" name="idTourDateDetails" id="idTourDateDetails" class="form-control clsDatePicker">
</div>
</div>
</div>
Script
<script type="text/javascript">
$('#idTourDateDetails').datepicker({
format: "mm-yyyy",
startMode: "months",
minViewMode: "months",
changeMonth: true,
changeYear: true,
minDate: '0d',
maxDate: '1y'
});
</script>
I tried adding data-date-format="mm-yyyy"
to the input
but it didn't work.
See working fiddle
I do not want to just hide the calendar, I want the dates to display the months instead. Other suggestion below only hide the calendar.
This fiddle is what I'm after but I can't get it working as when I put the HTML and the JQuery into my solution, I get the dates still displayed.