JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<form action="">
    <label for="startDate">Select a date:</label>
    <input type="text" id="startDate" name="startDate">
</form>

JavaScript

$("document").ready(function() {
    var timestamp;
    $("#startDate").datepicker({
        onSelect: function(e) { 
            var dateAsObject = $(this).datepicker( "getDate" ); 
            timestamp = dateAsObject.getTime(); 
            console.log("user selected: " + timestamp);
            otherFunction();
        }
    });

    function otherFunction() {
        console.log("test: " + timestamp);
    }
});