JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery.ui.all.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>Date:
<div id="datepicker"></div>
JavaScript
var startDate = '2014-08-05';
var endDate = '2015-08-05';
var numOfRows = 3;
var numofMonthPerRow = 5;
var strDateFormat = 'yy-mm-dd';
$(function () {
$("#datepicker").datepicker({
hideIfNoPrevNext: true,
numberOfMonths: [numOfRows, numofMonthPerRow],
defaultDate: new Date(startDate),
minDate: new Date(startDate),
maxDate: new Date(endDate),
dateFormat: strDateFormat
});
//remove last 2 months as we require only 13 months
var totalMonths = numOfRows * numofMonthPerRow; // = 15
var requiredMonths = monthDiff(new Date(startDate), new Date(endDate)); // = 12
//Add 1 to difference as we require the month with endDate too
$("#datepicker > div > div.ui-datepicker-group").slice(requiredMonths - totalMonths + 1).remove();
});
function monthDiff(d1, d2) {
var months;
months = (d2.getFullYear() - d1.getFullYear()) * 12;
months -= d1.getMonth();
months += d2.getMonth();
return months <= 0 ? 0 : months;
}