JSFiddle - React, Tailwind, and code Playground
HTML
<input id="datePicker" type="date" />
<input type="button" id="test" value="test"/>
JavaScript
$(document).ready( function() {
var now = new Date();
var day = ("0" + now.getDate()).slice(-2);
var month = ("0" + (now.getMonth() + 1)).slice(-2);
var today = now.getFullYear()+"-"+(month)+"-"+(day) ;
$('#datePicker').val(today);
$('#test').click(function(){
testClicked();
});
});
function testClicked()
{
console.log( $('#datePicker').val());
}