JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<input type="text" id="pickupdate"/>
<input type="button" id="logValue" value="log value"/>

JavaScript

var pickupdate;
$(function(){
  $.datepicker.setDefaults(
    $.extend( $.datepicker.regional[ '' ] )
  );
  $( '#pickupdate' ).datepicker( {
    dateFormat: 'yy-mm-dd',
    maxDate: "+3m",
    minDate: 0,
    onSelect: function() { 
      pickupdate = $(this).datepicker( 'getDate' ); 
      alert(pickupdate)
 }
  });
});
console.log(pickupdate)

$("#logValue").on("click", LogValue);

function LogValue() {
    console.log(pickupdate);
}