JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/themes/base/jquery-ui.css">
<ol>
    <li>Select a new month - the getDate function will return the old date.</li>
    <li>Select the new month again - the getDate function will return the new date.</li>
</ol>
<input type="text" id="datepicker" />

JavaScript

$(function() {
    $('#datepicker').datepicker({
        onClose: function() {
            alert($('#datepicker').datepicker('getDate'));
        }
    });
    $('#datepicker').datepicker('option', 'dateFormat', 'mm yy');
});