JSFiddle - React, Tailwind, and code Playground

HTML

<input id="dp" value="" />
<br />
<button onclick="makeDP();">Make DatePicker</button>
<button onclick="getValue();">Show Date</button>

JavaScript

function makeDP() {
    $( "#dp" ).datepicker({ dateFormat: 'mm-dd-yy' });  
}
function getValue() {
   alert($.datepicker.formatDate( 'yy-mm-dd', $( "#dp" ).datepicker("getDate") )  );  
}