JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.0/themes/smoothness/jquery-ui.css">
<table>
<tbody>
<tr>
<th>From:</th>
<td><input id="start" type="text"/></td>
</tr>
<tr>
<th>To:</th>
<td><input id="end" type="text"/></td>
</tr>
</tbody>
</table>
CSS
body {
font-family: cursive;
}
.ui-datepicker-calendar { display: none; }
JavaScript
$("#start").datepicker({
changeMonth : true,
changeYear : true,
dateFormat : "MM yy",
minDate : new Date(2017, 0, 1),
yearRange : "1970:+1",
showButtonPanel : true,
onClose: function() {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
var selected = new Date(year, month, 1);
$(this).datepicker('setDate', selected);
var date = new Date(year, month, 1);
date.setMonth(selected.getMonth() + 11);
$("#end").datepicker("option", "maxDate", date);
$("#end").datepicker("option", "minDate", selected);
}
});
$("#end").datepicker({
changeMonth : true,
changeYear : true,
dateFormat : "MM yy",
minDate : new Date(2017, 0, 1),
yearRange : "1970:+1",
showButtonPanel : true,
onClose: function() {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
var selected = new Date(year, month, 1);
$(this).datepicker('setDate', selected);
var date = new Date(year, month, 1);
date.setMonth(selected.getMonth() + 11);
$("#start").datepicker("option", "maxDate", selected);
$("#start").datepicker("option", "minDate", date);
}
});